Filter löschen
Filter löschen

Traversing through a matrix row by row extracting elements from mimimum to maximum values in each row

1 Ansicht (letzte 30 Tage)
I have a matrix 1000x6 and want to go through each row elements from min to max order as below:
Columns 1 through 5
0.592128412629931 17.0328745042388 7.80797504750628 2.62020782562556 1.43548900176002
7.70611478980228 18.2818027853596 8.55499281480929 11.2270196387823 10.0060429058785
11.1494174009673 21.4056872109407 11.4261074945239 15.7693095114145 12.041994367597
11.7455399739892 21.5579262590289 16.2448025417738 22.3080196456516 12.9307080813381
16.1940849940913 22.8583802772591 28.1474408671353 23.7985917372857 13.5205777727122
Column 6
2.59409159128796
6.2186461977726
8.7886056470611
22.6010592652641
23.2648494555368
I have this command but it can only give me min value per row. How can I get next higher value in a loop?
>> min(arrival_schedule(1:10,:),[],2)
ans =
0.592128412629931
6.2186461977726
8.7886056470611
11.7455399739892
13.5205777727122
15.5331848959514
16.3512299443613
16.5525102572458
17.4860712673065
20.5693257283949

Akzeptierte Antwort

madhan ravi
madhan ravi am 11 Mai 2019
mink(arrival_schedule(1:10,:),2,2)
% ^ n number of minimum elements
  3 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by