Detect monotonic decrease and record the corresponding rate
显示 更早的评论
Assume I have the following data:
D1= {'3/25/2024 15:01:10' 15
'3/25/2024 15:01:26' 25
'3/25/2024 15:01:42' 25
'3/25/2024 15:01:58' 23
'3/25/2024 15:02:14' 22
'3/25/2024 15:02:30' 15
'3/25/2024 15:02:46' 25
'3/25/2024 15:02:50' 24
'3/25/2024 15:02:59' 23}
I'd like to find the rate the variable decreases from 25 to 15. For this dataset, once the value has reached 15, it will jump back up to 25, and I'd like to record the next decreasing rate (and repeat).
So for example, I would record 10/ ('3/25/2024 15:02:46' - '3/25/2024 15:02:30') or 10/(16 seconds)
The next rate would be 10 / ('3/25/2024 15:02:59' - '3/25/2024 15:02:50') or 10/(9 seconds).
I believe I need to use ischange to detect when the values jump back up to 25, and ignore noise. (Assuming that the decreasing rate is monotonic).
Thanks
采纳的回答
更多回答(1 个)
Does this help?
D1= {'3/25/2024 15:01:10' 15
'3/25/2024 15:01:26' 25
'3/25/2024 15:01:42' 25
'3/25/2024 15:01:58' 23
'3/25/2024 15:02:14' 22
'3/25/2024 15:02:30' 15
'3/25/2024 15:02:46' 25
'3/25/2024 15:02:50' 24
'3/25/2024 15:02:59' 23};
t = cell2table(D1)
var = t{:, 2};
rows15 = find(var == 15)
dateTimes = D1(rows15, 1)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!