How sort rows of matrix as per given index

I have a matrix, A A = [1 2 3, 4 5 6, 7 8 9];
I want to sort rows of this matrix as per sequence of [2nd row; 3rd row; 1st row]
Thanks & Regards

 Accepted Answer

A = [1 2 3 ; 4 5 6 ; 7 8 9];
idx = [2 3 1] ;
A = A(idx,:)

More Answers (0)

Categories

Asked:

on 10 Aug 2017

Answered:

on 10 Aug 2017

Community Treasure Hunt

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

Start Hunting!