From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue writing re-formed waveform to file: Multiple data columns corresponding to same timestamp are being concatenated into a single column resulting in mismatched timestamps

Hello,

 

I'm using 6 accelerometers connected to a cDAQ-9174 with NI 9215 modules to calculate angular accelerations of a rigid body in accordance with algorithms in literature.

 

I'm having some issues writing my waveform to file. In my code I've split my waveforms into their components and performed some calculations on the data. I reform my waveform with the timestamp, dt and new Y which is a 1D array with 3 columns. When I write this waveform to file each row should contain the timestamp and 3 columns of data however the "Write Waveform to File vi." outputs a row containing the timestamp and only a single column of data. It appears to concatenate the data into a single column with each element assigned to consecutive timestamps.

 

How can I ensure each row contains the timestamp and the 3 data points that correspond to this time?

 

The vi is located in the bottom right corner of my consumer loop, to the right of a for loop. The file it outputs is alpha_anat.

 

Thanks in advance for assistance with this.

 

Thanks,

Rach_17

0 Kudos
Message 1 of 5
(2,488 Views)

Some issues I see.

 

You have a missing subVI called Export Waveforms ..... wo extra line.

 

You are only sending 1 waveform (built into an array) to them and the Export Waveforms subVI that isn't missing.

 

In the loop, you are initializing an empty array and using Insert into Array.  Very odd.  When placing new data at the end of the array, just use Build Array.  (Build Array is correct about 99% of the time, Insert into Array should only be used about 1% of the time if you actually plan on inserting data into the middle of an array.)

 

It is not clear about what you are referring to when you say a "row of 3 data points".  What data points?  The ones that are in different waveforms?

0 Kudos
Message 2 of 5
(2,465 Views)

Thanks for your response.

 

Apologies about the missing vi, it is a modified version that I've just copied and pasted there for the meantime.

Thanks for the tip with the build array, I'll modify my code accordingly.

 

The for loop executes 3 times therefore the single waveform is a 1D array of length 3.

 

The loop calculates the instantaneous angular accelerations of a system about the x,y and z axes therefore the values in the 1D array must all have the same timestamp.

 

I think I may be incorrectly entering the data into the build waveform vi. Would I need 3 waveforms(1 for the x values, 1 for y values and 1 for z values) to ensure they have the same timestamp?

0 Kudos
Message 3 of 5
(2,422 Views)

I've attached screenshots of my front panel and block diagram. The waveform indicator on the front panel shows the timestamp and the 1D array (3 Y values ). I would think this means the 1D array values should all have the same timestamp however in my text file (also attached below) they have been separated and assigned to consecutive timestamps.

 

Would this error of the values being assigned to different timestamps be occurring when the waveform is exported to file, or does the build waveform iterate through the 1D array and assign each consecutive value to consecutive timestamps?

Download All
0 Kudos
Message 4 of 5
(2,398 Views)

A waveform by definition is a series of data that is spread over time.  The data starts at time T0 and is separated by the value of dT.  So the timestamp of the 0th value of the array is the T0 timestamp.  Element #1 is T0 + dt.  Element #2 is T0 + 2*dt.

 

I don't know why you'd think all those elements in a waveform would have the same timestamp.   The writing to a file accounts for the fact that a waveform is a time-series of data.

0 Kudos
Message 5 of 5
(2,378 Views)