how can I find the cell no: of the minimum value in a m*n*x matrix

1 回表示 (過去 30 日間)
Pratheesh Ben
Pratheesh Ben 2014 年 8 月 8 日
コメント済み: Michael Haderlein 2014 年 8 月 8 日
A=[1 2 3; 4 5 6]; I should get an answer (1,1) for the value 1 which is placed in A. 1st row, 1st column.

回答 (1 件)

Ahmet Cecen
Ahmet Cecen 2014 年 8 月 8 日
index=find(A==min(A(:)));
Then A(index) will give you the minimum value. If you need the explicit 3D index checkout the function "ind2sub" after finding the above index.
  1 件のコメント
Michael Haderlein
Michael Haderlein 2014 年 8 月 8 日
Actually, the second output argument of min is the same:
[~,ind]=min(A(:))

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by