Find indexes of variables in vector
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Jonasz
il 12 Ago 2013
Commentato: Andrew Reibold
il 15 Lug 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?
0 Commenti
Risposta accettata
the cyclist
il 12 Ago 2013
Modificato: the cyclist
il 12 Ago 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 Commento
Andrew Reibold
il 15 Lug 2014
Thanks cyclist. Didn't realize you could use | or & in the find command.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!