chain overloading subref () and accessing child with '.'

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!