フィルターのクリア

find max value in a matrix

1 回表示 (過去 30 日間)
Ace_ventura
Ace_ventura 2015 年 2 月 22 日
コメント済み: Star Strider 2015 年 2 月 22 日
I have a=[ 1 2 3; 7 8 9; 4 5 6; 2 1 3]. I want to find max value in the matrix 'a' but i don't want it to consider second row. So I should get 6 as the answer. How to do it?

回答 (1 件)

Star Strider
Star Strider 2015 年 2 月 22 日
This works:
a=[ 1 2 3; 7 8 9; 4 5 6; 2 1 3];
a_134 = a([1 3 4],:);
max_a134 = max(a_134(:));
  2 件のコメント
Ace_ventura
Ace_ventura 2015 年 2 月 22 日
Thanks Man. But is there a way in which i don't have to define a_134 . I am looking for the max value without defining any sub matrix
Star Strider
Star Strider 2015 年 2 月 22 日
In that instance, just nest two max calls:
max_a134 = max(max(a([1 3 4],:)))

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by