LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Align multiple arrays by value

Solved!
Go to solution

I have a number of files and each file contains two columns: X1, Y1; X2, Y2; X3,Y3; etc.

These files are just bell shaped curves where the peaks happen at different X values (in other words, the peaks are shifted).

I would like to generate one file with X1, Y1, Y2, Y3, etc. such that the maximum Y from each file is at the same location as X1.

 

The idea is to shift these curves so that they all lie on top of each other as much as possible. The attached Excel sheet shows what I want.

 

How can I do this?

 

0 Kudos
Message 1 of 5
(2,943 Views)

Hello Murchak,

 

Have you already written a piece of code?

 

One easy way to start would be to work with the Array Max & min function (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/array_max_and_min/).

Based on the resulting indexes you can then "shift" the array.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 2 of 5
(2,941 Views)

Thank you ThiCop.

 

Yes I have written a code for the first part of the problem. Basically, I am using the first file as the baseline curve, and the subsequent files need to be normalized to the baseline curve.

My VI does that so far. Next is the do the shifting. 

So your idea is to find the row index of max Y1, and row index of max Y2, etc, and shift the arrays by the difference between these row indexes? I will try that and see where I get with that.

 

Thanks,

0 Kudos
Message 3 of 5
(2,938 Views)
Solution
Accepted by topic author murchak

Hello murchak,

 

If you have any questions or get stuck somewhere, then don't hesitate to post some code and let us help you.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 5
(2,915 Views)

Hi,

 

Thanks for the suggestion. I got it worked out!

0 Kudos
Message 5 of 5
(2,902 Views)