Effacer les filtres
Effacer les filtres

Using builtin subsref make different results

1 vue (au cours des 30 derniers jours)
Martin
Martin le 7 Sep 2016
Commenté : per isakson le 14 Sep 2016
Hello, currently in my project I am overloading subsref function and I am little bit confused, because I overload some cases, for other I am still using builtin subsref function.
On example I have created 2 simple classes:
classdef example < handle
properties
cellArray
end
methods
function obj = example()
obj.cellArray{1} = 'first';
obj.cellArray{2} = 'second';
end
function varargout = subsref(obj, s)
[varargout{1}] = builtin('subsref', obj, s);
end
end
end
and second one:
classdef example2 < handle
properties
cellArray
end
methods
function obj = example2()
obj.cellArray{1} = 'first';
obj.cellArray{2} = 'second';
end
end
end
This classes seems similar, but in some cases the results is different, for example:
obj1 = example;
obj2 = example2;
Now, when I want display cellArray as:
>> obj1.cellArray{:}
ans =
first
>> obj2.cellArray{:}
ans =
first
ans =
second
>>
So as can be seen the output of the individual classes is different, and its making me mess in further code development, do you have any tips how to change class example to work exactly like example2 class?

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by