How do I turn a nxm matrix into a single array?
Mostrar comentarios más antiguos
hi Matlabers,
say I have a matrix
[1 2 3 4;5 6 7 8;9 10 11 12; 13 14 15 16]
how can I turn this matrix so all the rows are combined into one. one after the other.
result
[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]?
thanks in advance. cheers SN
Respuesta aceptada
Más respuestas (1)
manoj saini
el 17 de Oct. de 2012
0 votos
to exact answer >>b=reshape(a',1,16) because matlab always prefer coloum element so pass a'(a transpose) for your exact output
1 comentario
Ahsan Khan
el 17 de Oct. de 2012
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!