LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Merge Chronologically two array from a chart graph

Solved!
Go to solution

Hi all,

 

I am working on peak detection for an application.

Mdr2093_1-1669138113316.png

 

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.

 

 

0 Kudos
Message 1 of 6
(203 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 2 of 6
(166 Views)

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.

Mdr20_0-1669198372963.png



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.

0 Kudos
Message 3 of 6
(138 Views)

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...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 4 of 6
(124 Views)
Solution
Accepted by topic author Mdr20

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

 

Mdr20_0-1669201975857.png

0 Kudos
Message 5 of 6
(115 Views)

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


  • Why do you use InsertIntoArray when you want to build an array from two inputs? There's a BuildArray function!
  • No need for OpenG, ArraySort can also sort your data (after creating an array of clusters from it).
  • Use an autoindexing loop to get your sorted data arrays…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 6 of 6
(85 Views)