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 Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by