how can I change the order of rows of a matrix in a predefined order? -


i wondering how can change order of rows of matrix in predefined manner?

let's have matrix a=[1 2; 3 4; 5 6; 7 8] , have vector b=[3 1 4 2]

can change order of according b?

to get: a_rearranged= [5 6; 1 2; 7 8; 3 4]

i tryed use sort command, gives me alteratives of sorting in mode descending , ascending

thank help! lena

you can index array array.

a_rearranged = a(b) 

*assuming you're using matlab. a[b] in python require indices start @ 0.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -