Suppose I have a 2 by 60 matrix, like A = [1:60,2:61] how can I reshape it by the first 10 rows so that I can get a 20 by 6 matrix??

2 次查看(过去 30 天)
B = reshape(A,rowSize(A)/6,[],6)

采纳的回答

C B
C B 2021-10-12
A = [1:60;2:61]
A = 2×60
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
B = reshape(A,[20,6])
B = 20×6
1 11 21 31 41 51 2 12 22 32 42 52 2 12 22 32 42 52 3 13 23 33 43 53 3 13 23 33 43 53 4 14 24 34 44 54 4 14 24 34 44 54 5 15 25 35 45 55 5 15 25 35 45 55 6 16 26 36 46 56

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by