Export peak labels with raw data findpeaks MATLAB

3 views (last 30 days)
I'm using find peaks to find local maxima or minima. I'd like to be able to export the original data in .csv format alongside a label indicating the peak number from a cumulative count of the identified peaks.
I'm able to locate and number the peaks fine but can only create an array of the peak locations and numbers, for the attached example it would be a 35 row array.
I'd like to create a table in the same format as attached here from some demo data created in excel.
Any suggestions would be very much appreciated.
Jon

Answers (1)

Image Analyst
Image Analyst on 5 Jul 2018
Edited: Image Analyst on 5 Jul 2018
Nothing is attached. You somehow forgot to do that. Please attach your data and code with the paper clip icon. You should see the files listed on your question if you've successfully attached them.
You can create the table from the double vectors that findpeaks() gives you using the table() function.
Then use writetable() to write that table to an Excel workbook file.
  2 Comments
Jon Schofield
Jon Schofield on 5 Jul 2018
Thanks for the answer, please see the attached file. I can make a table of the findpeaks vectors alone, it's lining it up with raw data that I'm struggling with.
Hope the file explains better and thanks again for the comment.
Image Analyst
Image Analyst on 6 Jul 2018
Sigh. Jon, you again forgot to attach your code. Please make it as easy as possible for people to help you, by helping them help you. You say you have code to make a table, find peaks, etc. yet you want people to recreate all that code when you already have it?! Most people would probably rather not and just wait for you to attach it. After all, they're in no rush. I'll check back tomorrow for it, after you've read this link.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!