I searched for days for a solution, but I get stucked. I have this simple class of an object:
classdef GRIDCELL < handle
properties
rho
end
methods
%% Constructor
function obj = GRIDCELL(rho)
if nargin ~= 0 % Allow nargin == 0 syntax
obj.rho = rho;
end
end
end
end
I create my objects for example with
G(1:3) = GRIDCELL(2)
Now, I wanted to update the value rho in all of the cells. But unfortunaly, this doesn't work
C = {11 22 33};
[G(1:3).rho] = C{:};
If I now proof this, all the values are only overwritten with the LAST value in C. I really don't understand it :(
G(1:3).rho
ans =
33
ans =
33
ans =
33
The build-in deal results in the same. Please, I searched a simple and fast way, to do this, without any Loops like in "num2cell" or stuff like this.