move rows in a matrix

21 views (last 30 days)
Ace_ventura
Ace_ventura on 20 Feb 2015
Commented: Ace_ventura on 20 Feb 2015
Guys, I have a Matrix X= [A; B; C; D ; E; a; b; c; d; e ; f] each alphabet represents a row matrix with three columns. I want a Matrix X= [ A; a; b; c; B; d; e; f; C; D; E]. How to do it??

Accepted Answer

Stephen23
Stephen23 on 20 Feb 2015
Edited: Stephen23 on 20 Feb 2015
Use MATLAB's rather powerful indexing ability:
X = [...];
X = X([1,6,7,8,2,9,10,11,3,4,5],:);

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!