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 天)
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.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by