Assume Q is a matrix which has 3 cells and in each cell it has 2 other cells, means:
Q={ { [] [] } ; { [] [] }; { [] [] } }
Moreover, if we have "a" and "b" which they have 3 member each, and we would like to place
"a(1,1)" into "Q{1}{1}",
"b(1,1)" into "Q{1}{2}",
"a(2,1)" into "Q{2}{1}",
"b(2,1)" into "Q{2}{2}",
"a(3,1)" into "Q{3}{1}",
"b(3,1)" into "Q{3}{2}",
For example, if
a = [2; 3; 4];
b = [1; 5; 8]
Then Q should be like
Q={{2 1};
{3 5};
{4 8}}
Please note that we need a vectorized code and not a for-loop code as I already have the latter one, as shown next -
for i=1:size(Q,2)
Q{i}{1}=a(i,:)
Q{i}{2}=b(i,:)
end
Thanks.