If it makes it easier, Tank doesn't necessarily have to = 0 for ten mins before and after, it just CANNOT = 1 within that time period.
I want to compare two data sets at slightly offset times.
1 次查看(过去 30 天)
显示 更早的评论
I have two sets of data, one called "MCA" and one called "Tank". I want to find the datetime where MCA = 10 as long as Tank has been equal to 0 for at least 10 minutes before and after the time MCA = 10. In datenum format, this corresponds to a time difference of +- 0.01. Is there a simple way to do this?
9 个评论
dpb
2017-6-21
编辑:dpb
2017-6-21
Not enough precision there to tell the difference but I think I now grok the issue. I'd first suggest switching to the new datenum class instead of datenum.
The list above is only three different values at that resolution; using datestr instead would show the underlying times...
Based on the description albeit not sufficient data to try it, if you have R2015a or later, see
doc uniqeutol
which might just solve your problem in a one-liner. What the doc doesn't say (and I can't test as don't have that recent a release) is whether it will work on datetime inputs or not. Since datenum is just a double, however, it will work on it which is what you've got at the moment anyway. Set the tolerance at 10/(24*60) and 'DataScale',1 to make absolute comparison. The key question is how do we "know" there are three separate events in the data? That's where we need to have the whole set of information available to use in the solution, not just this list of times...
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!