Strip duration row with time duration 00:00:00:000
3 views (last 30 days)
Show older comments
Life is Wonderful
on 19 Dec 2019
Edited: Life is Wonderful
on 25 Dec 2019
Hi
I want to remove all rows expect the last with duration 00:00:00:000
Sample out data
0 Comments
Accepted Answer
Adam Danz
on 19 Dec 2019
Edited: Adam Danz
on 19 Dec 2019
I'm assuming the WeirdDuration data are duration values. This simple solution assumes that you want to eliminate all rows starting at the first row until the last rows that contains a duration of 0.
% T is the table
lastZeroIdx = find(T.WeirdDuration == duration(0,0,0), 1,'last');
T(1:lastZeroIdx-1,:) = []
[update]
if WeirdDuration are not duration values, you can easily modifty the line of code above to use datetime values instead. Example: datetime(0,0,0)
6 Comments
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!