Maximum arrays of a matrix

조회 수: 1 (최근 30일)
armin m
armin m 2021년 12월 5일
댓글: Walter Roberson 2021년 12월 6일
Hi i have a matrix woth 543 arrays. I wanna choose 10 maximum arrays between these 543 arrays. Need help!
  댓글 수: 4
armin m
armin m 2021년 12월 6일
편집: armin m 2021년 12월 6일
Yes all the same size and numeric. Matrix may changes in each loop
DGM
DGM 2021년 12월 6일
That's just a numeric vector. You said you have a matrix of arrays.

댓글을 달려면 로그인하십시오.

채택된 답변

DGM
DGM 2021년 12월 6일
If all you need to work on is a numeric vector, then
W = [3 5 4 6 7 8 66 444 33 23 4];
Wmx = maxk(W,5) % R2017b or newer
Wmx = 1×5
444 66 33 23 8
Note that maxk() is relatively new. You can also do the same thing using sort()
% any version
Wmx = sort(W,'descend');
Wmx = Wmx(1:5)
Wmx = 1×5
444 66 33 23 8
  댓글 수: 9
armin m
armin m 2021년 12월 6일
That do my work. But if that can be use for more than 1 ro and column, it is better.thank a lot
Walter Roberson
Walter Roberson 2021년 12월 6일
use ind2sub() to convert the second output into a row and column number.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by