11-22-2022 11:36 AM
Hi all,
I am working on peak detection for an application.
Each peak has to increment a counter, each valley will decrease it.
The threshold is set at 200 for both valleys and peaks. If the counter goes to negative value, counter will be 0.
I used the peak detector.vi of labview.
The image represent the merge of three different element in the same graph:
- raw file
- peaks
- valleys
Is there a way to merge the peaks and valleys arrays only into one array in such a way to simplify the counter logic with a simple addition or subtraction?
From the attached image I expected that the counter will be 2.
Important is that the two array has to be merged in chronological order like in the image.
Thank you in advance for the support.
Solved! Go to Solution.
11-22-2022 01:32 PM
Hi Mdr,
@Mdr20 wrote:
Each peak has to increment a counter, each valley will decrease it.
The threshold is set at 200 for both valleys and peaks.
Then why do you ignore the first valley? It's clearly below -200…
@Mdr20 wrote:
The image represent the merge of three different element in the same graph…
Did you know we cannot debug/edit/run images in LabVIEW? Especially images showing parts of frontpanels???
@Mdr20 wrote:
Is there a way to merge the peaks and valleys arrays only into one array in such a way to simplify the counter logic with a simple addition or subtraction?
Important is that the two array has to be merged in chronological order like in the image.
Probably there is a way!
When you know the position of each valley/peak then you can easily use that information to sort your data!
11-23-2022 04:17 AM
Hi GerdW,
thanks for your answer.
Then why do you ignore the first valley? It's clearly below -200…
My bad, the threshold is +-200.
Did you know we cannot debug/edit/run images in LabVIEW? Especially images showing parts of frontpanels???
Here the block diagram of the peak and valley recognition + counter logic.
Probably there is a way!
When you know the position of each valley/peak then you can easily use that information to sort your data!
Indeed, I assumed it is possible but I have problem to merge the two amplitudes array with the locations chronologically.
Thanks for your time.
11-23-2022 04:46 AM
Hi Mdr,
@GerdW wrote:
Did you know we cannot debug/edit/run images in LabVIEW? Especially images showing parts of frontpanels???
It seems you don't understand what I was trying to say here: please attach code! Real code!
It also helps to set some default values to help us to examine your code...
11-23-2022 05:21 AM
Hi GerdW,
maybe you were not clear either 😀
Anyway, I solved it. Thanks anyway.
For those who had the same problem:
- Merge the two array with insert into array.vi
- In my case, Real part represent the location of the peak/valley.
- For loop with the index array will give as output the sorted array based on sorted pointers given by openG sort array.vi
11-23-2022 07:36 AM - edited 11-23-2022 07:36 AM
Hi Mdr,
@Mdr20 wrote:
- Merge the two array with insert into array.vi
- In my case, Real part represent the location of the peak/valley.
- For loop with the index array will give as output the sorted array based on sorted pointers given by openG sort array.vi