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??

3 visualizaciones (últimos 30 días)
B = reshape(A,rowSize(A)/6,[],6)

Respuesta aceptada

C B
C B el 12 de Oct. de 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

Más respuestas (0)

Categorías

Más información sobre Code Generation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by