Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Hi I have m by n matrix,I want to find the index of the max. of each column.It can be found by [i j]:max(x,[],2).this gives the index of max of each column in vector i.I want if there is a repetion in vector i to be reset to 0.thanks

1 回表示 (過去 30 日間)
yousef Yousef
yousef Yousef 2013 年 11 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi I have m by n matrix,I want to find the index of the max. of each column.It can be found by [i j]:max(x,[],2).this gives the index of max of each column in vector i.I want if there is a repetion in vector i to be reset to 0.thanks

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 11 日
編集済み: Azzi Abdelmalek 2013 年 11 月 11 日
m=[1 2 3;0 5 6;2 1 7;0 4 9]
[ii,jj]=max(m)
%[ii ji]=max(x,[],2) gives the max of each row
  6 件のコメント
yousef Yousef
yousef Yousef 2013 年 11 月 11 日
But when I use [ii jj]=max(r,[],2) instead of using [ii jj]=max(r).It does not work.Do you know why. I'm writing the max function in this way to find the max of each column.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 11 日
No, you are looking for the max of each row, to find the maximum of each column
[ii ,jj]=max(r)
%or
[ii, jj]=max(r,[],1)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by