table and readtable Error "Invalid default value for property 'varDim' in class 'table':"

21 visualizaciones (últimos 30 días)
I am getting this error when trying to read data as either a XLSX and CSV file into a table both using readtable, and by manually reading in the data and constructing a table. I am running Matlab 2018a, and have also tried previous versions.
I see some answers to similar Errors involving duplicated scripts named "table", but I don't see any spurious duplicate named scripts in my path.
I am stumped and would appreciate any suggestions. Thanks!
>> AllPoints = readtable('ScarpProf.xlsx')
Error using readtable (line 197)
Invalid default value for property 'varDim' in class 'table':
The VariableNames property must contain one name for each variable in the table.
>> [dist,elev] = textread(file,'%f %f','delimiter',',','headerlines',1);
>> table(dist,elev)
Error using matlab.internal.tabular.private.tabularDimension/init_impl (line 194)
Invalid default value for property 'varDim' in class 'table':
The VariableNames property must contain one name for each variable in the table.
Error in matlab.internal.tabular.private.varNamesDim/init (line 54)
obj = init_impl(obj,dimLength,dimLabels);
Error in matlab.internal.tabular.private.varNamesDim (line 48)
obj = obj.init(length,labels);
>> table(dist,elev,'VariableNames',{'Distance','Elevation'})
Error using matlab.internal.tabular.private.tabularDimension/init_impl (line 194)
Invalid default value for property 'varDim' in class 'table':
The VariableNames property must contain one name for each variable in the table.
Error in matlab.internal.tabular.private.varNamesDim/init (line 54)
obj = init_impl(obj,dimLength,dimLabels);
Error in matlab.internal.tabular.private.varNamesDim (line 48)
obj = obj.init(length,labels);
  4 comentarios
dpb
dpb el 7 de Ag. de 2018
You have an installation or other system-related problem...the attached file is read fine here w/ R2016b.
Have you tried a reboot to see if that might clean things up?
If no joy, looks like it's time to contact official TMW Support; don't think there's anything we can do here to help on this one.
Emily
Emily el 7 de Ag. de 2018
Thanks! Happy for confirmation, at least, that it runs fine one someone else's installation. I have not tried my linux box, I'll try that first and then contact support.

Iniciar sesión para comentar.

Respuesta aceptada

Emily
Emily el 10 de Ag. de 2018
Ok, I never found which was the script that was conflicted, but after moving all of my own scripts to the bottom of my path (as is the preferred way!), it now works just fine.

Más respuestas (1)

Jibril
Jibril el 9 de Nov. de 2023
Error using matlab.internal.tabular.private.metaDim
Invalid default value for property 'metaDim' in class 'table':
Execution of script all as a function is not supported:
C:\Users\user\Desktop\FD CODE\all.m
Error in Overall_art (line 997)
plot(Rate,'-d','Displayname','INI')
  1 comentario
Walter Roberson
Walter Roberson el 9 de Nov. de 2023
MATLAB permits construction of functions that only apply to particular data types. It would, for example, be possible to construct a class named FluidDynamics and then define function named "all" that was invoked only when the parameter was a FluidDynamics object.
But otherwise, outside of class definitions, any function you defined is assumed by matlab to apply to all possible data types (through the function might test what it received and give an error message)
So when you created your all.m function, matlab assumed that you were deliberately writing a replacement for the standard all() function, and that your all.m will take care of the details of calling the matlab all() function if the condition is not right for your custom all.m to apply.
MATLAB assumes that if you went to the trouble of defining your own all.m function conflicting with the standard all() function, that you must have had a Very Good Reason, and matlab does not stand in your way.
The problem is that your all.m is not a suitable replacement function in any circumstance, as it is not even a function.
The moral of the story is: do not create functions or scripts with the same name as Mathworks provided functions... not unless you have a Very Good Reason

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by