LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the right timestamp in excel

Solved!
Go to solution

I'm currently acquiring a lot data and I'm trying to export to excel with the time. However, when it exports to excel it starts at the right time but count every data point as a second. So, when it runs for about two minutes it shows in excel running for over ten minutes. I've attached my code and an example of the excel.

 

Also, if there are any additional issues in the code please let me know

 

Thanks in advance.

Download All
0 Kudos
Message 1 of 6
(2,258 Views)
Solution
Accepted by anotherabby

A couple problems you have is that you are using a stacked sequence structure.  Replace that with a flat.  You shouldn't need to create and kill DAQ tasks in every frame.  You should be able to just create them before your For Loop, kill them after.  And just write new values to the channels when you need to.  If you do that, you can probably delete the sequence structure altogether.

 

But the problem you are having is related to your acquisition loop in there.  Again you are creating a resource every loop iteration, but you aren't even clearing it.  Your loop runs as fast as it can only controlled by the speed those subVI's for the DMM take to run.  You acquire scalar data and build it into an array, but there is no timing information associated with it.  So when the "To DDT" function runs to convert that array to a Dynamic Data Type that the Express VI accepts, it just assumes a default value of 1 second between data points.

 

Try to control your acquisition loop rate, and work with waveforms rather than arrays.

0 Kudos
Message 2 of 6
(2,242 Views)

How would you recommend I try to control the acquisition rate?

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

Put a wait function in there.

0 Kudos
Message 4 of 6
(2,208 Views)

So I added a wait function but I merged it with the Dynamic data signal. The result is a crude version of what I want, which is the two middle columns. Is this close to what you had in mind? 

Download All
0 Kudos
Message 5 of 6
(2,203 Views)

When creating the constant for the wait, just right click on the Wait function and pick Create Constant.  Now you will have the correct datatype for that function and won't have the red coercion dot.  Your code will still work as you have that, but it is the correct type, looks better, and is less clicks to do it.

 

You don't need both wait functions in the same loop.  They just run in parallel.  The one is redundant.

 

You still haven't moved the creation and the stopping of the  NI-DMM tasks out of the loops.

 

And you still haven't turned your array into a waveform.  You dropped in something, but didn't do anything with it.  Try adding the dT element to the Build waveform that is based on your wait function constant.

Message 6 of 6
(2,193 Views)