Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Finding array with maximum value at each row

Asked by sushma sharma on 20 Apr 2013

hi,

i have three 10 x 1 arrays, a, b, and c. how can i write a function that show which array has the highest value at each row. the output will be something like this: a c b b a .... any help would be appreciated! sushma

0 Comments

sushma sharma

Tags

Products

No products are associated with this question.

1 Answer

Answer by the cyclist on 20 Apr 2013
>> [~,idx] = max([a,b,c],[],2)

idx will be 1,2, or 3, indicating whether a,b, or c has the max.

2 Comments

sushma sharma on 20 Apr 2013

thank you!

the cyclist on 20 Apr 2013

Since my answer solved your issue, please consider accepting it, for the benefit of those seeking similar solutions in the future.

the cyclist

Contact us