Borrar filtros
Borrar filtros

Using builtin subsref make different results

1 visualización (últimos 30 días)
Martin
Martin el 7 de Sept. de 2016
Comentada: per isakson el 14 de Sept. de 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?

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by