I WANT TO SOLVE THIS PROBLEM

1 回表示 (過去 30 日間)
abduall hassn
abduall hassn 2015 年 8 月 22 日
編集済み: abduall hassn 2016 年 11 月 3 日
I want select max value from very row
like this until 364

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 22 日
[maxvals, maxidx] = max(YourMatrix, [], 2);
Now maxidx will be a vector of column numbers, one per row.
  4 件のコメント
abduall hassn
abduall hassn 2015 年 8 月 23 日
編集済み: Walter Roberson 2015 年 8 月 23 日
Thanx alot brother
But i want to ask. Why u give 2?
And think u again
[maxvals, maxidx] = max(YourMatrix, [], 2);
Walter Roberson
Walter Roberson 2015 年 8 月 23 日
The 2 refers to dimension #2, the columns . The above functions equivalently to
for K = 1 : size(YourMatrix,1)
[maxvals(K,1), maxidx(K,1)] = max(YourMatrix(K,:),[]);
end
If you left out the 2, then the default would be to work along the first non-singular dimension, like
for K = 1 : size(YourMatrix,2)
[maxvals(1,K), maxidx(1,K)] = max(YourMatrix(:,K),[]);
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by