필터 지우기
필터 지우기

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