I have an array of objects, all of the same class. Is it possible to apply a function (defined in the methods section in the class) to all the objects in the array at once? for example, the class definition is:
classdef myClass
properties
x=0;
end
methods
function obj=plus1(obj)
obj.x=obj.x+1;
end
end
end
Now I can create an object A of class myClass:
A=myClass;
and apply the method plus1:
A=A.plus1;
However, if I create an array of objects of the same class:
A(1,10)=myClass;
is it possible to apply 'plus1' to the 10 objects of A at once?
something like:
A(:)=A(:).plus1;
Thanks guys :)