select/ extract only increasing part among both increasing and decreasing set of data
3 次查看(过去 30 天)
显示 更早的评论
I have a data set which initially increases and then decreases. I want to select/ extract only increasing part. How shall I do this?
0 个评论
回答(1 个)
Walter Roberson
2019-5-1
locs = strfind([diff(DATA)<0,true], [0 1]) + 1;
DATA(1:locs(1))
The code was written like this to have protection for the case where the data is all ascending. You could also find(diff(DATA)<0,1) and test for isempty()
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!