LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating 1D Array of Time Values (from Waveform)

Hi all,

I'm working on a program which will compare elements (y1 and y2 from index i1 and i2 respectively)
If y1 is not equal to y2 then I want to store the first time value of the waveform/array that I'm getting the data from. I would then step through the array to compare all the elements in order. I'm assuming that the time values are the same as the index which I can get from the loop iteration count. I want to store these time values/specific indices in a 1D array to display.

But I'm having trouble with the last part and I'm not sure if this is how I go about this problem. 

All answers are much appreciated and welcome. 

Thanks!

0 Kudos
Message 1 of 7
(4,729 Views)

Hi Ghoster,

 

wire the time values to an autoindeing output tunnel of your comparison loop...

 

Or attach a VI as an example of what you're talking about!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(4,721 Views)

Hi GerdW,

Sorry, I should have attached the vi earlier. Here it is! What I described earlier is the bottom section of the while loop. 

Don't be too alarmed when you see the code, I am still new to Labview and not sure what I'm doing wrong. 

Thanks for helping me.

0 Kudos
Message 3 of 7
(4,717 Views)

Time time values will not be the same as the array index unless you are acquiring at 1 hz. What I usually do if needing to convert a waveform to x and y arrays is use get waveform components and that will give you the y array. Then use "ramp pattern.vi" VI to create an X array of timestamps. Here is an example

 

 

Download All
0 Kudos
Message 4 of 7
(4,715 Views)

Sorry, attached the wrong VI so I'm reposting because I ran out of time to edit! This may be a little overly-complex so there may be a better way. But let me know if this is more what you're looking for. You'll have to add the logic for the greater than into the for loop yourself. Also, I am not sure what you want to compare index 0 from the array to. Do you want to skip the comparison there or compare it to zero? If you want to skip that comparison and just start at index one, you could use a case structure around all the code in the for loop and if i=0 you don't do anything.

 

Edit: Just realized you weren't looking for a difference but an equality, you will have to modify the code a bit but hopefully this is a starting point.

 

Download All
0 Kudos
Message 5 of 7
(4,702 Views)

Hi,

 

Thanks a lot for this. I was wondering if there was another way to set up the x values into the array. It doesn't seem to work for me or maybe it has something to do with formatting the time values. 
Is there another way to get time without using time stamps?

 

Thanks 

0 Kudos
Message 6 of 7
(4,681 Views)

@Ghoster wrote:

Is there another way to get time without using time stamps?

 

Thanks 



I'm not exactly sure what you're asking. Do you mean you want to convert the doubles back to timestamps? There is a convert to timestamp primative available in LabVIEW. 

0 Kudos
Message 7 of 7
(4,677 Views)