chain overloading subref () and accessing child with '.'
1 view (last 30 days)
Show older comments
Hi All,
Am new to Matlab and having a problem overloading subsref.
In short, I have a class that wraps a container.map. I want to overload the () operator to return instances of the referenced item in the map. Then access using the '.' operator. i.e.
a = MyClass(MyEnums.Enum1).Data
However, cannot get it working..
This is my current attempt
function varargout = subsref(obj,S)
switch S(1).type
case '()'
[varargout{1:nargout}] = obj.Parameters(uint32(S(1).subs{1}));
case '.'
[varargout{1:nargout}] = builtin('subsref', obj, S(1));
end
end
Many many thanks in advance for any help
0 Comments
Answers (0)
See Also
Categories
Find more on Data Type Conversion 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!