Check max value of an array against a constraint

hi i have the following matrix
a= 1 1 1
5 0.6 1
2 0.5 0.9
how would i find the maximum value that is not > or = to 1 so in this case 0.9. Additionaly the matrix can be various dimensions.is it possible using the max command if not how would i approach this problem?

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 4월 17일
편집: Andrei Bobrov 2013년 4월 17일

0 개 추천

max(a(a<1));
and index of the location
a1 = a;
a1(a1<1) = -inf;
[value,i1] = max(a1(:));
[ii,jj] = ind2sub(size(a),i1);
out = [value, ii, jj];

추가 답변 (0개)

카테고리

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

질문:

AI
2013년 4월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by