Rearranging Array Rows into Multiple Blocks while Maintaining the Old Order
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Saeid
el 18 de Mzo. de 2019
Comentada: Saeid
el 18 de Mzo. de 2019
How can I rearrange an array from alternating rows to multiple blocks, maintaining the order of the rows?
2 comentarios
madhan ravi
el 18 de Mzo. de 2019
please illustrate with a input and the desired output as text instead of picture
Respuesta aceptada
Jos (10584)
el 18 de Mzo. de 2019
You should learn about indexing, one of the most essential aspects of Matlab:
M = randi(4,10,5) ; M(:,1) = 1:size(M,1) % example data
M2 = M([1:2:end 2:2:end], :) % re-ordering the rows
0 comentarios
Más respuestas (1)
madhan ravi
el 18 de Mzo. de 2019
Editada: madhan ravi
el 18 de Mzo. de 2019
reshape(matrix,[],size(matrix,2))
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!