Effacer les filtres
Effacer les filtres

Find indexes of variables in vector

2 vues (au cours des 30 derniers jours)
Jonasz
Jonasz le 12 Août 2013
Commenté : Andrew Reibold le 15 Juil 2014
I need to find indexes of variables in vector which are eg. out of my set range.
Range eg. from 600 to 2000
Vector of 1000 variables and I need only indxes of that variables which are out of this range.
Any ideas?

Réponse acceptée

the cyclist
the cyclist le 12 Août 2013
Modifié(e) : the cyclist le 12 Août 2013
If x is your vector, then
idx = (x<600) | (x>2000);
is a logical index pointing to the out-of-range values.
If you need the actual positions,
idx = find((x<600) | (x>2000));
  1 commentaire
Andrew Reibold
Andrew Reibold le 15 Juil 2014
Thanks cyclist. Didn't realize you could use | or & in the find command.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by