How to split an array by same length and make a matrix?

5 visualizaciones (últimos 30 días)
Arnab Pal
Arnab Pal el 17 de Ag. de 2019
Comentada: KALYAN ACHARJYA el 17 de Ag. de 2019
I have an array. a=[1 2 3 4... 24 25 26 27... 48 49 50... 72]
I want a matrix from that array. i.e. b=[1 2 3... 24; 25 26 27... 48; 49 50 51... 72]
After 24 interval it will be in next row.
small code is preferable.

Respuesta aceptada

Stephen23
Stephen23 el 17 de Ag. de 2019
>> a = 1:72;
>> b = reshape(a,24,[]).'
b =
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by