08-27-2012 02:51 AM
Hi All,
As I am new to Labview, I am asking another (possibly!) simple/naive question!
I know how to get latest y-value while running a VI. However, I do not know how to get the associated time stamp (x-value) with the y-value.
I need both the x & y values during the execution of my program to do some other things.
Please see attached code.
I used the Index Array Function. But it only gave me y-value. No time stamp!
Cheers,
Saif
08-27-2012 04:23 AM
Hello Vhha,
That's actually a good question there. The data type returned by the DAQ Assistant is dynamic, and allows you to convert them into different data type. If you need the timestamp information, you may want to convert your data into waveforms.
In fact, as you DAQ assistant has 2 channels, you can get an array of 2 waveforms. To do so, use the Convert dynamic data function in the Express -> Manipulation palette, then configure it to get a 1D array of waveforms.
Regards,
Eric
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
08-27-2012 08:22 AM
As Eric mentioned, you should have the DAQ Assistant output a waveform. The waveform is a fancy cluster with Y (the array of data points), t0 (the timestamp of the first data point), and dt (the time between samples). To get the timestamp of the last element, you will have to multiply the number of points by dt and then add t0.
08-28-2012 01:21 AM
Hi Eric,
Thanks so much!
I could not understand the empty array connection on the left boundary of the for loop. Could you upload the VI?
This is what I have and it give error.
Cheers,
Saif
08-28-2012 02:46 AM
Hey Vhha,
You could download the snippet and drag it on your diagram, the associated code would have been generated 😉
Regards,
Eric
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
08-28-2012 08:51 PM
Thank you so much Eric. I downloaded Safari and the snippets work well from within it.
But I think I framed the question wrongly!
I want to be able to have access to latest x and y values (updating as data comes in).
From the x-value (which may be an index), I can get (using DELTA T) t = 0, 1, 2, etc.
y-vlaue is the latest data value.
Would this be possible?
Saif
08-28-2012 09:27 PM
For example, when I write data to a lvm file from two channels, I get one time column and two y-value columns.
Please see attached image of lvm file.
I want access to the latest elements (last row) of this file (in realt-me) while I am running my program in Labview.
Cheers,
Saif
08-28-2012 09:38 PM
Access in the sense what you want do with that? In general if you want to access the last row of the 2D array you can simply index it by checking the size of the array but am not sure what you want to achieve
08-28-2012 09:57 PM
08-28-2012 10:04 PM
So from the beginning until the pressure reaches 80mmHg you want to calculate the time taken right? so once you start the pumping start a clock say Elasped time function then once the pressure reaches the required value stop the clock and check the time. This should be simple depending on how you design the code.