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{:});
eval, especially without any warnings. See this answer of mine and references therein on why it's best to avoid it whenever possible. Gist is: hard to debug errors and slow execution due to disabling of the JIT.
it did not work?