0

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?

beginh
  • 1,103
  • 3
  • 24
  • 36

1 Answers1

1

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.

Community
  • 1
  • 1
Shai
  • 102,241
  • 35
  • 217
  • 344