Hello everyone,
in a class that I wrote I overload the subsrefs-method. In specific cases I use builtin to call the builtin subsref-function.
function varargout = subrefs(obj, S) try varargout = builtin('subsref', obj, S) catch %do stuff
endend
However when I try to get a property of an object-array the code-line
varargout = builtin('subsref', obj, S)
returns that property of the first element only!
Even though usually
objectArray.property
would return that property of all objects in the array one after another. So if only one property is return it would have to be the one from the last elemtent in the array, not the first.
In this specific case a for-loop would help, but then it wouldn't work for subscripted references of type '()' and '{}'.
Is it a bug or do I do something wrong? What can I do to change that?
Or what would be even better: is there an analogous method that gets called only if in subrefs there was a mistake?
So basically an equivalent to Pythons __getattr__ ?
Thank you for your help
Best Answer