How to find location of a matrix array by array.

조회 수: 1 (최근 30일)
Ratchanon Rompo
Ratchanon Rompo 2021년 7월 30일
댓글: Ratchanon Rompo 2021년 7월 30일
A = [1 4 5 2 6 8 5 4;
2 5 3 5 9 2 4 5;
3 2 6 4 2 4 5 3];
Amax = max(A');
lo = find(A==Amax');
then I got [9; 14; 16;] for their positions. What do I have to do if I want their positions to be on each array? I want lo to be [6; 5; 3].

채택된 답변

Johnny Himbele
Johnny Himbele 2021년 7월 30일
Hi Ratchanon,
This page describes that find function is able to ouput the row and column indices if you set two output arguments.
Here is an example.
A = [1 4 5 2 6 8 5 4;
2 5 3 5 9 2 4 5;
3 2 6 4 2 4 5 3];
Amax = max(A');
[row, column] = find(A==Amax');
I hope this helps you.
Thank you,
Johnny
  댓글 수: 1
Ratchanon Rompo
Ratchanon Rompo 2021년 7월 30일
Thank you. I do really appreciate your generosity.

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

추가 답변 (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