Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



sorting an array
Posted:
Feb 2, 2014 2:39 AM


I have a matrix of size 7 x 2. The first column numbers 1 to 33. It is like this A=[1 0.743 2 0.734 3 0.843 4 0.694 5 0.274 6 0.458 7 0.358]
Now I want to arrange the second column in descending order and the first column must also move correspondingly. If B is the output B=[5 0.274 7 0.358 6 0.458 4 0.694 2 0.734 1 0.743 3 0.843].
I can't use the command B=sort(A,2,'descend') as the corresponding first column is wrong. Kindly help me.



