how to convert 2D matrix to 1D
684 ビュー (過去 30 日間)
古いコメントを表示
i want to convert 2D array with size 83*6580 to 1D array , any help ?
0 件のコメント
回答 (2 件)
Star Strider
2014 年 12 月 13 日
If you just want to make a vector out of it, use the ‘(:)’ notation:
A = rand(83,6580);
V = A(:);
‘V’ is a (546140x1) double.
3 件のコメント
Stephen23
2018 年 2 月 14 日
"To make V as 1D array"
Unlike some languages MATLAB does not have any concept of 1D arrays: all arrays have atleast 2 explicit dimensions and infinite implicit trailing singleton dimensions. Because the first dimension is the row dimension the most "basic" kind of vector is actually a column vector.
AIJAZ BHAT
2020 年 11 月 2 日
編集済み: AIJAZ BHAT
2020 年 11 月 2 日
Alright I also want to add a precaution here while using it, It operates in column wise concatenation.
अंबरीश प्रशांत चांदूरकर Ambarish Prashant Chandurkar
2019 年 7 月 26 日
To Convert a 2D Matrix into a 1D Array( i.e a row vector), such that row vector is formed by concatenating consecutive rows of the 2D Matrix, use the following Code :
OneDArray = reshape(TwoDArray',[1 size(TwoDArray,1)*size(TwoDArray,2)]);
2 件のコメント
Tyler David MacLean
2020 年 10 月 6 日
I dig the matrix math here didnt even thing of doing it like this.
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!