Putting column vector in a matrix
2 ビュー (過去 30 日間)
古いコメントを表示
for i = 1:N
for row = 1 : n
for col = 1:m
grad(row,col)= .... %%%% I get a n x m matrix %%%%
end
end
gradv = grad(:); %%% Now I convert the matrix in a column vector %%%
%%%% For the outer loop "for i = 1:N", I get a coulmn vector gradv on every iteration. I want to put it in a matrix N x (nxm).
gradmatrix = gradv (1); gradv(2);... gradv(N) %%% How do I do this?
0 件のコメント
採用された回答
madhan ravi
2018 年 12 月 13 日
編集済み: madhan ravi
2018 年 12 月 13 日
gradv=cell(1,N);
for i = 1:N
for row = 1 : n
for col = 1:m
grad(row,col)= .... %%%% I get a n x m matrix %%%%
end
end
gradv{i} = grad(:);
end
celldisp(gradv)
matrix=[gradv{:}]
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!