How do you reshape an array to preserve the order in each row of the original array?

How do you reshape an array into a 1-dim column such that the first row of the original array is the first set of numbers in the column, followed by the numbers in the second row, and so on?
For example A = magic(3) should become:
B = [
8
1
6
3
5
7
4
9
2];

 採用された回答

A = magic(3)
A = 3×3
8 1 6 3 5 7 4 9 2
reshape(A.', [],1)
ans = 9×1
8 1 6 3 5 7 4 9 2

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索

製品

リリース

R2021b

タグ

質問済み:

2023 年 3 月 27 日

回答済み:

2023 年 3 月 27 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by