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 visualizzazioni (ultimi 30 giorni)
B = reshape(A,rowSize(A)/6,[],6)

Risposta accettata

C B
C B il 12 Ott 2021
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

Più risposte (0)

Categorie

Scopri di più su Code Generation in Help Center e File Exchange

Tag

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by