How to filter a certain range of values in a column vector of thousand rows
28 次查看(过去 30 天)
显示 更早的评论
I want to find a range of values in a column vector of a minimum value of 20% and a maximum value of 90%. The column has 2000 rows. suppose i want to filter values between a range of 70% to 80%. sample code for i = 1:length(PP) if (70% <= PP(i) <= 80%) filtered_PP(i) = PP(i) end end I later separate it and still i'm not getting the correct the answer
for i = 1:length(PP) if (70% <= PP(i) && 80% >= PP(i)) filtered_PP(i) = PP(i) end end
0 个评论
采纳的回答
TAB
2018-5-25
PP = (0:100)';
filtered_PP_Idx = find((PP>=73 & PP<=80));
filtered_PP = PP(PP>=70 & PP<=80);
3 个评论
jhoan giraldo
2022-4-26
You already have the indexes in filtered_PP_Idx. If you have for example a 'time' vector:
time_indexed=time(filtered_PP_Idx);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!