getting a max of a matrix without repetition of index
Show older comments
I have a matrix say A=[0.33 0.57 0.004 0.11; 0.39 0.01 1.00 0.003; 0.06 0.10 0.05 0.09;]
and I need max and its index of each row; which I type [MAC col]=max(A,[],2);
the results it gives me is MAC=[0.57 1.00 0.10] and col=[2 3 2].
What I need is to have col=[2 3 4] and MAC=[0.57 1.00 0.09] which has no repetition in the index "col". In this case maximum is unique for each column; if row 1 and row 3 have their maxima at a same column 2; I need MATLAB to detect which one is higher, take that as maxima of the corresponding row. for the other row the next maxima would be the answer. Does anybody know how I can do that without programming?
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!