how can i change the dimensions of a matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
how can i change the dimensions of a matrix from 100000*5 to column vector 100000*1 without making any change of sequence of records
0 件のコメント
回答 (2 件)
KSSV
2016 年 10 月 2 日
k = rand(100000,5); %random matrix
k1 = k(:,1) ;% first column
k2 = k(:,2) ;% second column
ki = k(:,i) ;% ith column, i=1,2,3,5
Read about matrix indexing.
2 件のコメント
Walter Roberson
2016 年 10 月 2 日
k = k(:,1);
This would lose information.
Is your intention that each element of the 100000 x 1 would be a vector of length 5? If so then
k_cell = mat2cell(k, ones(1, size(k,1)), size(k, 2));
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!