find values between constants in vector
1 次查看(过去 30 天)
显示 更早的评论
I have a vector freq_n where I want to find the indices corresponding to values between a and b.
freq_in-10*delta_f <= freq_n <= freq_in+10*delta_f
How would I go about doing this? The find() function seems to only allow one relational operator, unless I am doing something wrong? thanks!
0 个评论
采纳的回答
Sean de Wolski
2011-9-21
idx = X >= a & X <= b;
where X is your vector, a is the lower bound, b is the upper bound. This will be their logical values. If you want numerical indices:
find(idx)
0 个评论
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!