How to find longest lasting event
1 回表示 (過去 30 日間)
古いコメントを表示
How to find longest lasting event?
means i wanna Calculate the duration of each event as the difference between 2 function..
1 件のコメント
回答 (2 件)
Image Analyst
2020 年 5 月 24 日
What form is your event data in? Is it like a binary vector [0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0]?
% 1's are in the event and 0's are where the event is not happening.
inEvent = logical([0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0])
% Extract the longest one and sum up the number of indexes of it.
longestDuration = sum(bwareafilt(inEvent, 1))
inEvent =
1×16 logical array
0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0
longestDuration =
6
7 件のコメント
dpb
2020 年 5 月 24 日
@IA, groupsummary is relatively recent addition to the splitapply workflow toolkit -- R2018x? I think or thereabouts.
It's another case of essentially the same functionality as a Toolbox function being migrated to base product excepting w/ a different name and slightly different syntax.
ahmed ibrahim
2021 年 1 月 11 日
What row in the data set does this correspond to (remember that min and max have a 2nd output that gives the row)?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!