What is causing this, 'Function 'subsindex' is not defined for values of class 'cell'.'?
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Jan
on 26 Feb 2017
Edited: Jan
on 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 Comments
Mattijs Mientki
on 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
on 21 Jun 2018
Edited: Stephen23
on 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
More Answers (0)
See Also
Categories
Find more on Power Converters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!