Check if an element is in the range or not

14 ビュー (過去 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 Center および File ExchangeNumeric Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by