Rearranging Array Rows into Multiple Blocks while Maintaining the Old Order
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Saeid
am 18 Mär. 2019
Kommentiert: Saeid
am 18 Mär. 2019
How can I rearrange an array from alternating rows to multiple blocks, maintaining the order of the rows?
2 Kommentare
madhan ravi
am 18 Mär. 2019
please illustrate with a input and the desired output as text instead of picture
Akzeptierte Antwort
Jos (10584)
am 18 Mär. 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 Kommentare
Weitere Antworten (1)
madhan ravi
am 18 Mär. 2019
Bearbeitet: madhan ravi
am 18 Mär. 2019
reshape(matrix,[],size(matrix,2))
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!