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

3 次查看(过去 30 天)
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];

采纳的回答

Bruno Luong
Bruno Luong 2023-3-27
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 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by