MSPEAKDETECT performs a peak detection algorithm over a set of spectra.
  P = MSPEAKDETECT(MZ,Y,T,SNR) finds relevant peaks in mass spectrometry data signals. MZ must be a column array of reading points and Y must be a matrix of MZ rows and size(Y,2) instances. The output P will be a boolean matrix of dimensions MZ x Y.
  A value that is detected as a peak must fulfill [Barla et al., 2008]:
  i) it must have the highest intensity among its neighbours,
  ii) it must be higher than a chosen threshold (default T=0),
  iii) it must be higher than a function of the signal to noise ratio (default SNR = 3).
  This function makes use of the Prados peak detection algorithm [Prados et al., 2006], but it includes some modifications. Basically, the algorithm starts by locating the highest point of the overall signal. Iteratively, the highest point p is chosen and considered a peak if there exists a point l (respectively r) on its left (respectively right), before the previous (next) peak that accomplishes two conditions: first, the value of the candidate peak p is higher than a sensitivity threshold T and, secondly, the candidate peak p has a SNR >= 3 in the intensity window framed by l and r.
  To estimate the SNR of the signal window, we borrow the proposal of [Shin et al., 2008] that computes the SNR value as the ratio between the peak's height and the median absolute deviation in the window around the peak under consideration.