LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

selecting points in an array

HI 

 

I generate a series of sine waves and store the values as an array, next i need to select only those points in the array that correspond to the amplitude of the sine wave i specify. Could anybody suggest how i go about it?

 

 

 

 

0 Kudos
Message 1 of 6
(3,065 Views)

Can you please post what you did so far? Post a sample so that it will be easy for us to help you and also you can learn fast.

 

Mathan

0 Kudos
Message 2 of 6
(3,063 Views)

Hi Mathan

 

The while loop generates the  amplitude values and i need to select the coresponding points from the array generated in the for loop.

0 Kudos
Message 3 of 6
(3,058 Views)

Hi cquark,

 

as you can't compare floats for equality you should use the InRange? function...

 

Change the epsilon to your needs (by replacing with a constant)!

Message Edited by GerdW on 11-17-2009 03:13 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(3,053 Views)
Since it's a sine wave can't you just use the Min/Max function to get the amplitude.  If you need all instances of the Max you could use Search 1D array.  Or if you know the frequency you should be able to get it just by adding that much to the index of the first max
Message Edited by elset191 on 11-17-2009 08:26 AM
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 5 of 6
(3,042 Views)

Thank you for the replies. In the vi you modified GerdW i have now included an array(array 3 in vi) such that i can obtain all the points at which the amplitudes were at any specified value, i.e at the max/min i should have 6 points and at any other amplitude i should have 12 points that have the same amplitude. For the abritrary values i have set,  the InRange function seems to be coercing all the points(1000 in this case) to one amplitude, as seen in array3.

 

I am sorry i have not mentioned why i intend on doing this. I generate a 3D spiral that i need to overlay on a stack of 2D images of fixed z increments, so for every image i will have one or 2 points where the trajectory intersects each image, i need to determine the corresponding (x,y) for each of the points such that i can overlay them on the image.

 

 

 

 

0 Kudos
Message 6 of 6
(3,021 Views)