The code below provides number of "bursts" or periods of activity (300 consecutive points = 0.2 s) above a given threshold. How could I add a further condition to the code that identifies "bursts" only when there are at least n values of separation (i.e. 1200 points) (below the threshold) between two different bursts?
above_threshold = (signal > threshold); minAcceptableLength = 300; % Find spans that are long enough.
isLongEnough = bwareafilt(above_threshold, [minAcceptableLength, inf]); % Count the number of spans (bursts) that are long enough.
[labeledSpans, numberOfBursts] = bwlabel(isLongEnough);
Best Answer