I wrote this to detect shapes that I know before hand (like sawtooth and steps).  You need to play with parameters, but I think it will work:

https://www.mathworks.com/matlabcentral/fileexchange/61291-shape_projection_filter?s_tid=prof_contriblnk


And then I've always had success with peakfinder:
https://www.mathworks.com/matlabcentral/fileexchange/25500-peakfinder-x0-sel-thresh-extrema-includeendpoints-interpolate