Saurabh Tariyal
Saurabh Tariyal

Reputation: 5

How to shift certain rows in matrix using matlab

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?

Upvotes: 0

Views: 111

Answers (1)

LowPolyCorgi
LowPolyCorgi

Reputation: 5188

You can do it with indexing:

Y = X([1 6 7 8 2 9 10 11 3 4 5],:);

If you want something more dynamic, like generating the indexing vector [1 6 7 8 2 9 10 11 3 4 5] on the fly, please be more specific.

Upvotes: 2

Related Questions