我有一个列矢量我想转换为单元格数组,例如:
A = rand(10,1);
B = cell(10,1);
for i=1:10
B{i} = A(i);
end
B =
[0.6221]
[0.3510]
[0.5132]
[0.4018]
[0.0760]
[0.2399]
[0.1233]
[0.1839]
[0.2400]
[0.4173]
如果没有明确的for循环,我怎么能这样做? 我试过了:
B{:} = A(:)
和
[B{:}] = deal(A)
没有运气......
如果可能的话,我怎么能对矩阵做同样的事情,即单元格中的每个元素本身?