how can i classify my matrix
Show older comments
heloo
i have a matrix with two vectors
i want to classify this matrix depending on the second vector for exemple
i have this matrix:
- 1 2 3 4 5
- 23 3 15 1 32 4
MY MATRIX AFTER CLASSIFICATION WILL BE
- 4 2 6 3 1 5
- 1 3 4 15 23 32
| MY CODE|
clc;
n=5;
x= 100;
y=100;
net = [rand([1,n])*x;rand([1,n])*y]
%v=SORTROws
Accepted Answer
More Answers (1)
Walter Roberson
on 16 Nov 2015
[~, idx] = sort(net(2,:));
sorted_net = net(:,idx);
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!