Finding maximal value in rows then aligning rows in order based on their increasing values
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Systematically Neural
am 8 Dez. 2017
Beantwortet: Matt J
am 8 Dez. 2017
I have data that that is in rows of 300 data points. Each of these data points has a maximal value over the 300 data points. I have the following code:
d=data;
h=heatmap(d2,'ColorMap',jet,'ColorScaling','scaledrows');
grid off
I want to order the rows so that the max values are increasing order. So if maximal value happens at the 10th point of 300 then it should go before one where max value is happening at 20th out of 300. I have tried indexing with max, but not sure how to use that to order them how I want.
I attached an example matrix of data consisting of eight rows of 300.
Any help would be greatly appreciated!
0 Kommentare
Akzeptierte Antwort
Matt J
am 8 Dez. 2017
[~,idx0]=max(data,[],2);
[~,idx1]=sort(idx0);
data_sorted=data(idx1,:);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!