I have a=[ 1 2 3; 7 8 9; 4 5 6; 2 1 3]. I want to find max value in the matrix 'a' but i don't want it to consider second row. So I should get 6 as the answer. How to do it?

답변 (1개)

Star Strider
Star Strider 2015년 2월 22일

0 개 추천

This works:
a=[ 1 2 3; 7 8 9; 4 5 6; 2 1 3];
a_134 = a([1 3 4],:);
max_a134 = max(a_134(:));

댓글 수: 2

Ace_ventura
Ace_ventura 2015년 2월 22일
Thanks Man. But is there a way in which i don't have to define a_134 . I am looking for the max value without defining any sub matrix
In that instance, just nest two max calls:
max_a134 = max(max(a([1 3 4],:)))

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

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2015년 2월 22일

댓글:

2015년 2월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by