LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get time stamp

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

0 Kudos
Message 1 of 20
(3,790 Views)

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.

DAQtoWF.png

 

Regards,

Eric

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

0 Kudos
Message 2 of 20
(3,779 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 20
(3,761 Views)

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 

0 Kudos
Message 4 of 20
(3,740 Views)

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.

0 Kudos
Message 5 of 20
(3,725 Views)

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

 

 

0 Kudos
Message 6 of 20
(3,690 Views)

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

0 Kudos
Message 7 of 20
(3,683 Views)

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

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 20
(3,677 Views)
Hi Anand,

Suppose I am increasing pressure in the system in terms of mmHg.

So, say, I want to compute how much time did the system take to pump to 80 mmHg. That is I want to compute ratio t/80. Based on this ratio, I want to oprate a valve, etc.

The system does not stop at 80 mmHg. It stops at around 180 mmHg. But I need to do some operations while the system is pumping.

Saif
0 Kudos
Message 9 of 20
(3,673 Views)

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.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 10 of 20
(3,669 Views)