Effacer les filtres
Effacer les filtres

Check if an element is in the range or not

10 vues (au cours des 30 derniers jours)
naman
naman le 5 Mai 2017
Modifié(e) : Adam le 5 Mai 2017
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 ?

Réponse acceptée

Adam
Adam le 5 Mai 2017
Modifié(e) : Adam le 5 Mai 2017
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

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by