Indexing at the end of flat peaks

2 views (last 30 days)
LukeJes
LukeJes on 2 Sep 2020
Commented: Luke Cohen on 25 Mar 2021
I have been using findpeaks to index my data, however, it is indexing the value at the start of each of the flat peaks. Instead, I want it to index the value at the end of the flat peaks so that I can cut up the data like I have done in my current code below:
[pksr, idcsr] = findpeaks(r_grf, 'MinPeakHeight',-100, 'MinPeakDist',100);
for k1 = 1:numel(idcsr)-1
grfcutr{k1} = r_grf(idcsr(k1)-10:idcsr(k1+1)-10);
end
I have looked at the documentation on flat peaks but it isn't helping in my case.
Image of my uncut data:
Thanks
  2 Comments
Image Analyst
Image Analyst on 2 Sep 2020
Is the value at the flat section always exactly 0, or (if not) do you want to consider values within a specified distance of 0 to be part of the "flat" section? Do you have the Image Processing Toolbox - if so, this has functions which would make it almost trivial. Please attach your data - make it easy for us to help you, not hard (by making us create data somehow).
save('answers.mat', 'r_grf');
Then attach 'answers.mat'.
Luke Cohen
Luke Cohen on 25 Mar 2021
Hi Image Analyst,
I am trying to do something similar to this... can you mention the function in the Image Processing Toolbox that would be useful?

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!