LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing an Array at multiple indexes

Solved!
Go to solution

Hello everyone,

 

I have just used the peak detector VI on 1-D array with a threshold.  I now have an array of indexes which I need to round in order to use as an actual index.  My question is, with this array of indexes corresponding to peaks, how do I grab those peak values

 

To give some context:

1.  I have three time correlated signals.  I filter them, normalize them, then add them so that I can increase the S/N ratio.

2.  Peak DetectionVI gives me an array of where these peaks are

3.  I want as my end result

      A. Signal1[peak_indices]

      B. Signal2[peak_indices]

      C.Signal3[peak_indices]

 

Now I am thinking about this in the way i would code it in MATLAB which is way easier, however I would like to do this in Labview and would greatly appreciate any insight.

 

Thanks,

 

-Joe

0 Kudos
Message 1 of 5
(5,237 Views)
Solution
Accepted by topic author Joe_Lyons_flowcytometry

As you have said, once you have rounded the peak locations to the nearest value you have an array of indexs. From there it should be a simple matter of passing that array into a for loop that auto-indexes the results that you have passed out to generate an array of the peak values.

 

Index Array.png

Message 2 of 5
(5,224 Views)

ogk.nz,

 

Thanks for your prompt reply.  I guess I was just hoping there was a non-loop way to do that, but I'll accept that as the best way to do it.

 

Thanks,

 

-Joe

 

0 Kudos
Message 3 of 5
(5,219 Views)

There's an OpenG function called "Index ID array elements" in the OpenG array group that is essentially the for loop that ogk.nz showed, but in a subfunction.

0 Kudos
Message 4 of 5
(4,251 Views)

I guess I don't understand is the problem.

 

What's wrong with just using the array of amplitudes coming out of the peak detector?

 

Unless all signals are similar in amplitude and noise, I would normalize after adding them, not before.

 

A for loop is one of the simplest and most efficient structures, so it is not something that should be avoided. Any primitive that operates on arrays has to loop one way or another, even you don't see it on the surface. 🙂 (Only on an FPGA you can process an entire array at once. :D)

0 Kudos
Message 5 of 5
(4,246 Views)