MATLAB: Random matrix 6*3 and i want set row according highest total of row set as first than lower

MATLABsorting

2.00 1.00 6.00 =9
0 8.00 2.00 =10
1.00 2.00 1.00 =4
5.00 0 8.00=13
6.00 0 5.00=11
3.00 0 6.00=9
now rearrange and set matrix is
5.00 0.00 8.00
6.00 0.00 5.00
0.00 8.00 2.00
2.00 1.00 6.00
3.00 0 6.00
1.00 2.00 1.00
this row order is not fix each time 6*3 random matrix but raw order high is set as first

Best Answer

A = [2.00 1.00 6.00
0 8.00 2.00
1.00 2.00 1.00
5.00 0 8.00
6.00 0 5.00
3.00 0 6.00];
thesum = sum(A,2) ;
[val,idx] = sort(thesum,'descend') ;
B = A(idx,:)