Why does MLPutRanges Return a Invalid Range Error?

1 visualización (últimos 30 días)
I have set up SpreadSheet Link to allow communication between Excel and MATLAB, and generally everything is working correctly.
When using the "MLPutRanges()" function from Excel, in certain SpreadSheets I recieve an "Invalid Range" or #INVALIDRANGE! error. This does not appear consistent, the function behaves as expected in some of my Excel files, but in other files the function does not work at all. What could be the cause of this?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 10 de Oct. de 2019
There are a few possible reasons to consider.
1. The "named range" that is being sent must only reference data from a single sheet in the workbook. You cannot send a "named range" that references values across multiple sheets.
2. The "named range" must have a name that is also a legal MATLAB variable name. Since the name of the "named range" is used to define the MATLAB variable name, any "named range" that does not follow MATLAB variable name standards will result in this error. Please consult: <https://www.mathworks.com/help/matlab/matlab_prog/variable-names.html>
3. Following from (2), Excel has a notion of a hidden "named range". You will not be able to see these "named ranges" from Excels "Name Manager" user interface. If you are still experiencing this error and you have checked that all your "named ranges" have valid names, please check for hidden "named ranges". Note that people have reported issues with Excel where a hidden "named range" is automatically created, so you might not have explicitly created one. To find if there is a hidden "named range" in your Excel file, execute the following Visual Basic script in Excels Developer Visual Basic window:
Sub ShowAllNames()
Dim n As Name
For Each n In ActiveWorkbook.Names
n.Visible = True
Next n
End Sub
This will reveal any hidden "named ranges" that may exist. Check these for illegal naming.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by