# MATLAB: Is there a way to detect a drop in values in an array

analysisclassclassesclassificationdistancegapimage analysisSignal Processing Toolbox

Hello, I would like to know if there is a way to detect a sudden drop in values in an array. Matlab should see when a gap starts and tell me in which class it happens. How do I get Matlab to recognize the large gap which starts in class 16 (see picture).
Here is the reason: My program should be able to recognize two piles of points. Therefore I have computed all distances from each point to an fixed vector (in each slice/plane). Afterwords I have classed them by distance. The gap in the classes means, that there is also a big gap between the points. Thus a new pile of points begins. Thank you.

lowAmounts = amount < 10; % Logical vector - use find() if you want actual indexes.
[peakValues, locations] = findpeaks(-amount);
differences = diff(amount);bigDrops = differences < -15; % or whatever value you want.