Reputation: 12665
I have a matlab struct that has a sub-element such that when I run
class(foo.bar)
Gives the error:
Error using class
The CLASS function must be called from a class constructor.
When I just run foo.bar
, ans
gets set several times.
How can I find out which class bar
belongs to?
Upvotes: 0
Views: 81
Reputation: 124563
I suppose you have a structure array as foo
. Example:
>> foo = struct('a',{1 2})
foo =
1x2 struct array with fields:
a
>> foo.a
ans =
1
ans =
2
>> class(foo.a)
Error using class
The CLASS function must be called from a class constructor.
>> class(foo(1).a)
ans =
double
Note that foo.a
returns here what is called a comma-separated list.
Upvotes: 2