Reshape to column vector
3 ビュー (過去 30 日間)
古いコメントを表示
I have
a =
1 2 3 4
5 6 7 8
9 10 11 12
I need to covert it to a column vector keeping the input order as follows,
b =
1
2
3
4
.
.
12
But when you use reshape funtion
b = [reshape(a,[12,1])]
b =
1
5
9
2
6
10
3
7
11
4
8
12
Can anyone help me on this?
0 件のコメント
回答 (1 件)
Star Strider
2021 年 10 月 9 日
Transpose ‘a’ before calling reshape —
a = [1 2 3 4
5 6 7 8
9 10 11 12];
b = reshape(a.',[],1)
.
2 件のコメント
Star Strider
2021 年 10 月 9 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!