Threshold detector
It takes incoming vector then find all parts that above threshold and cut the vector to above threshold parts.
It returns cell array of above threshold parts of the vector and two arrays of start-indexes and end-indexes.
[ parts, starts, ends ] = ThresholdDetection( Vector, threshold )
%% find start and end points
a=Vector>=threshold;
a=a(:);
a=[0;a;0];
a=diff(a);
starts=find(a==1);
ends=find(a==-1)-1;
%% cutting
parts=cell(length(ends),1);
for i=1:length(ends)
parts{i}=Vector(starts(i):ends(i));
end
end
Cite As
Ilya Prokin (2026). Threshold detector (https://www.mathworks.com/matlabcentral/fileexchange/36024-threshold-detector), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
