LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write data to a file wth time

Hi,

 

I am trying to record some data and time in a text file that I would be able to open the data file in Excel later. I have worked on the program and it works but I have some questions, and I would appreciate if somebody can help that I would be able to improve my code.

 

1) I wrote the data in a spreadsheet (test1 vi), however I read in the discussion forum that this not the best way to record the data since it slows down the program, and I am trying to run my code in a high sampling rate. So, I tried to write the data in a text file (test 2 vi), now the data is written 5 times for each time step (text file attach). Can somebody give me any suggestion what is wrong with the code that record the data more than one for each loop?

 

2) I am recording the time by using Tick count inside and outside the loop. Is there any better way to record the time?  

 

Thanks a lot,

Azadeh

0 Kudos
Message 1 of 5
(2,906 Views)
Files are attached
Download All
0 Kudos
Message 2 of 5
(2,902 Views)

It looks like your problem are the Initialize Array elements where you are creating 1D arrays with 5 elements.

When the arrays are transposed they result in 5 rows of data.

Just connect the data straight to the Build Array and delete the Transpose Array.

Message 3 of 5
(2,889 Views)
Thanks, yes after I change the array element size from 5 to 1, the problem is solved and still I need to transpose the array.  Any suggestion to record the time from any other method? Thanks!
0 Kudos
Message 4 of 5
(2,879 Views)
You are using NI-DAQ so unless there are timing mechanicsms associated with that, what you are doing now is the
way I would do.
0 Kudos
Message 5 of 5
(2,859 Views)