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

1 次查看(过去 30 天)
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

采纳的回答

madhan ravi
madhan ravi 2019-5-11
mink(arrival_schedule(1:10,:),2,2)
% ^ n number of minimum elements
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by