What is causing this, 'Function 'subsindex' is not defined for values of class 'cell'.'?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daryl Hurwitz
am 26 Feb. 2017
Bearbeitet: Stephen23
am 21 Jun. 2018
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 Kommentare
Akzeptierte Antwort
Jan
am 26 Feb. 2017
Bearbeitet: Jan
am 26 Feb. 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 Kommentare
Mattijs Mientki
am 21 Jun. 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
am 21 Jun. 2018
Bearbeitet: Stephen23
am 21 Jun. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Power Converters finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!