I want to use a function repmat to write this code:
for j=1:30
for i=1:10
myObject{i,j}.s = zeros(6,1);
end
end
I cannot understand how to do that for cells. Can anyone help me please?
I want to use a function repmat to write this code:
for j=1:30
for i=1:10
myObject{i,j}.s = zeros(6,1);
end
end
I cannot understand how to do that for cells. Can anyone help me please?
You can use deal
:
[myObject{1:10,1:30}] = deal( struct('s',zeros(6,1) );
PS: It is best not to use i
and j
as variables in Matlab.