Find indexes of variables in vector

6 次查看(过去 30 天)
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?

采纳的回答

the cyclist
the cyclist 2013-8-12
编辑:the cyclist 2013-8-12
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 个评论
Andrew Reibold
Andrew Reibold 2014-7-15
Thanks cyclist. Didn't realize you could use | or & in the find command.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by