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

2 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by