Assuming that the test data is a vector of y values, you can use the following code to segment the data and get the start and end points:
main.m718 chars32 lines
This code will plot both the original test data and the segmented data with start and end points marked. The y_min and y_max variables define the threshold values for segmentation. Any segment of the test data between these values will be considered a valid segment. The segments variable contains the start and end indices of each segment. The segment_start and segment_end variables are simply the first and second columns of the segments variable, respectively.
gistlibby LogSnag