Threshold detector

It takes parts of incoming vector that above threshold and return cell array of parts.
289 Downloads
Updated 4 Apr 2012

View License

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 (2024). Threshold detector (https://www.mathworks.com/matlabcentral/fileexchange/36024-threshold-detector), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Fuzzy Inference System Modeling in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0