Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save Multiple analog channel data with timestamp into spreadhseet/csv file

Solved!
Go to solution

Hi All,

 

I have USB DAQ device which I am using to acquire analog voltage from 4 channels (though different sampling rate). I am having trouble in saving the data to spreadsheet/csv file. I need to add timestamp as first column and have 4 other columns of data with different headings and also need to make a new file for every day.

Please see my attached try, I tried to use build array but all I get is a single string from get time and date function inside loop. how can I add time stamp to the file.

 

Thank you.

0 Kudos
Message 1 of 9
(4,140 Views)
Solution
Accepted by AnkitG

Hello AnkitG,

 

if you are using one device, then only one sample rate can be used for all channels normally set the fastest rate.
Do you want the timestamp for each sample?

If you are using waveform instead of double, you get the start timestamp and the delta t.

 

Attached an example not tested. I also recommend to split the acquisition from write to spreadsheet with a queue.

 

best regards
Alexander
0 Kudos
Message 2 of 9
(4,080 Views)

 


@Duffy2007 wrote:

Hello @AnkitG

 

if you are using one device, then only one sample rate can be used for all channels normally set the fastest rate.
Do you want the timestamp for each sample?

If you are using waveform instead of double, you get the start timestamp and the delta t.

 

Attached an example not tested. I also recommend to split the acquisition from write to spreadsheet with a queue.

 

 

Hi Alexander,

 

Thank you very much for the help but xls file generated by the program now have all the data in one column and time stamp in one. how can I have separate column for each channel data and timestamp ( I only need one timestamp column)

you mentioned to split the acquisition with queue how can I do that.

 

Thanks for the help,


 

0 Kudos
Message 3 of 9
(4,074 Views)
Solution
Accepted by AnkitG

Hello AnkitG,

 

attached a modified example not fully tested.

Please also save the file as .csv instead of .xls and separate the values with ; instead of ,

best regards
Alexander
0 Kudos
Message 4 of 9
(4,052 Views)

thank you very much alexander, though " ," worked rather then " ; " for csv file

0 Kudos
Message 5 of 9
(4,046 Views)

Hi there,

Can you guys please upload your vi again for labview 2015 or earlier. 

0 Kudos
Message 6 of 9
(3,461 Views)

Saved the last posted VI in 2015.


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
Message 7 of 9
(3,457 Views)

@crossrulz wrote:

Saved the last posted VI in 2015.


Thanks a lot for the upload.

However, I have another question I am building a VI which generates step signals and sine wave signals using USB - 6001's both output channels. I am acquiring the generated command signals whether it is a step signal or sine wave by looping back the generated command to AI0 and the feedback from other 4 motors as well to AI1 ~ AI3. 

 

I am using build table express VI to log data and then to write it in file. I want to switch between manual command (Step signal) and sine wave command whenever I want during a session and at the end of session I wish to plot all the command signals and feedback signals in a single plot in the order and magnitude as they were given. That is why i am appending the data in a single file. However, when I use manual command for the first time to give let's say three command signals the data is logged properly after pressing 'save data' I also press 'clear data' after saving the data. Then I switch to sine wave it also logs the data properly. At this point if i press plot results the are plotted as I wish. After that I switch to manual command and when I press the 'send command' signal i see that table is not cleared and it remembers the old data as well so I see four data entries in the table while I was expecting to see only one.

 

I have used the "Reinitialize to default value" option already that is of no use because the data temporarily goes but when I write new data the previous data also comes back. I tried to use the reset option of the table as well but since the tables are built in the case structure elsewhere so the clear data button does not serve the pupose even if it is attached to the reset input of table vi. So i tried to use local variables and "Value" property node of tables but that is of no use too. 

 

Please help I am attaching the VI and screen shots as well. Please forgive me for any stupid mistakes and the messy code because I know I am still learning.

0 Kudos
Message 8 of 9
(3,441 Views)

Hello shami81,

 

all things are running in parallel acquisition and writing the values to the table. Try to use a state machine so all steps are defined when something should happen.

 

Simple state machine

best regards
Alexander
0 Kudos
Message 9 of 9
(3,429 Views)