MATLAB: List of maximum number in the matrix

arraymatrixmaximum

Hi everyone,
Suppose I have a matrix:
a = [3;1;4;2;3;4;1;4;3;1;2;4];
Then I want matrix b to be:
b = [3;6;8;12]
  • Matrix b is included the rwo number of all max number in the matrix a, e.g. row(3)=4; row(6)=4; row(8)=4; row(12)=4;
Can anyone please help me?

Best Answer

a = [3;1;4;2;3;4;1;4;3;1;2;4];
idx=find(ismember(a,max(a)))