I'm new to Matlab and I was told, that it is faster to use dot operator instead of for loop when performing the same operation on array.
Example:
A = 1:200
A = A .* 10;
Instead of:
A = 1:200
for i = 1:200
A(i) = A(i) * 10;
end
I have created an multi-dimensional array of Objects (the objects are instances of class I created). Is it possible to call the same method with the same arguments on all instances without using the for loop?
I have tried this 3 approaches, but they don't work (A is three-dimensional array):
A(:,:,:).methodName(argument1, argument2);
A.methodName(argument1, argument2);
A..methodName(argument1, argument2);
arrayfun( @(x) x.methodName(argument1, argument2), A )