What is causing this, 'Function 'subsindex' is not defined for values of class 'cell'.'?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Daryl Hurwitz
el 26 de Feb. de 2017
It worked once before and now it will not give the time of day. Can anyone with this issue?
last = {'Smith';'Jones';'Webb';'Anderson'};
first = {'Fred';'Kathy';'Milton';'Johnn'};
age = [6;22;92;45];
height = [47;66;62;72];
weight = [82;140;110;190];
table(last,first,age,height,weight)
This is the error
Function 'subsindex' is not defined for values of class 'cell'.
0 comentarios
Respuesta aceptada
Jan
el 26 de Feb. de 2017
Editada: Jan
el 26 de Feb. de 2017
You have redefined the term "table" as a variable. See:
which table -all
This so called shadowing causes troubles frequently. The solution is easy: Avoid using names of built-in functions as variables. In your case:
tableback = table;
clear('table');
Then your code runs successfully.
5 comentarios
Mattijs Mientki
el 21 de Jun. de 2018
Could you explain how he redefined table? He is just using the table function in the code right? I have a similar issue but with subsindex of string and I have no clue how it works or what is the problem
Stephen23
el 21 de Jun. de 2018
Editada: Stephen23
el 21 de Jun. de 2018
@Mattijs Mientki: table was redefined like this:
table = ...
It might have been in some code written by the OP, or perhaps in some third-party code that they (unknowingly) called, but the end results is that table ended up being something that was not the inbuilt function.
Use which to check which function/variable/... are mapped to that name:
which table -all
Más respuestas (0)
Ver también
Categorías
Más información sobre Power Converters 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!