say I have got two cell arrays a, b:
for k=1:3
a{k} = nan(3, k);
end
b = {ones(1, 1), ones(1, 2), ones(1, 3)};
how I assign each cell in b into the second line of each cell of a?
say I have got two cell arrays a, b:
for k=1:3
a{k} = nan(3, k);
end
b = {ones(1, 1), ones(1, 2), ones(1, 3)};
how I assign each cell in b into the second line of each cell of a?
Just have a loop:
for i=1:size(a,2)
a{i}(2,:) = b{i}
end
If a and b are small, you can use deal:
[a{1}(2,:) a{2}(2,:) a{3}(2,:)] = deal(b{:});