Hi,
The ‘find’ function returns the indices of elements in an array that satisfy a specified condition. In the spectrogram matrix, where each element represents a magnitude value at a certain frequency and time, ‘find’ can be used to locate all points where the magnitude exceeds a threshold. This returns two sets of indices which include row indices corresponding to frequencies and column indices corresponding to times. You can then use these indices to extract the actual frequency and time values from the frequency vector and time vector, respectively.
The following steps will help you get the y-values for the specific z-values (here ‘samp’):
- Use the ‘find’ function to find indices for the condition(samp>-10):
[row, col] = find(Samp > -10);
- Extract corresponding y-values (frequencies) using the computed ‘row’ indexes from the ‘find’ function:
frequencies = fS(row);
Below is the output for a sample data:

Please refer to the following documentation links to know more about the ‘find’ function:
I hope this helps!