Finding array with maximum value at each row

조회 수: 7 (최근 30일)
sushma sharma
sushma sharma 2013년 4월 20일
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

채택된 답변

the cyclist
the cyclist 2013년 4월 20일
>> [~,idx] = max([a,b,c],[],2)
idx will be 1,2, or 3, indicating whether a,b, or c has the max.
  댓글 수: 2
sushma sharma
sushma sharma 2013년 4월 20일
thank you!
the cyclist
the cyclist 2013년 4월 20일
편집: the cyclist 2013년 4월 20일
Since my answer solved your issue, please consider accepting it, for the benefit of those seeking similar solutions in the future.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by