Matlab tool for waveform detection and analysis