Rearranging Array Rows into Multiple Blocks while Maintaining the Old Order
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
How can I rearrange an array from alternating rows to multiple blocks, maintaining the order of the rows?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208980/image.png)
2 Commenti
madhan ravi
il 18 Mar 2019
please illustrate with a input and the desired output as text instead of picture
Risposta accettata
Jos (10584)
il 18 Mar 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 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Cell Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!