필터 지우기
필터 지우기

Check if an element is in the range or not

조회 수: 10 (최근 30일)
naman
naman 2017년 5월 5일
편집: Adam 2017년 5월 5일
Hi, I have a range e.g. lower range = [1,1,1,1] and upper range = [10,100,20,30] and I want to check if some element e.g. [ 2,3,4,100] is in the range or not. In other words, I want to check if the element lies in the hyperbox or not. How can I do that ?

채택된 답변

Adam
Adam 2017년 5월 5일
편집: Adam 2017년 5월 5일
a = [1 1 1 1];
b = [10 100 20 30];
c = [2 3 4 100];
isInHyperbox = all( c >= a & c =< b );
Obviously use < and > if you want it strictly within the box

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by