LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daq and write to array

Hello All,

 

I have a data acquisition task, as shown in the attached file. In order to speed up the data acquisition process, I am planning to first acquire and save the data into an array, and then write the whole chunk into a txt file. I have searched a lot, but I could not find how to do this. Can someone instruct me or give an example link to do so.

 

Thanks.

Amir

Amir
0 Kudos
Message 1 of 20
(4,200 Views)

Hi Amir,

 

I found de following example for you:

 

Continuously Read Data and Log to a TDMS File

https://decibel.ni.com/content/docs/DOC-11300

 

This example acquire data and write after the acquisition the data in a TDMS File.

I think this example will help you.

0 Kudos
Message 2 of 20
(4,193 Views)

Thank you very much for you help. But I have two more questions:

 

1- The TDMS file, as pops up at the end, does not have the corresponding time stamps for each acquired voltage value. How can I store the time stamps in the same file as well?

2- I have another dependent measure in the loop that I need to store it in the same file. How can I add this value to the TDMS file so that at the end I can have that as well.

 

Basically I need three colums in my output TDMS file:

1- Voltage values

2- The time stamps correponding to each acquired voltage

3-  Another dependent measure, which is computed within the loop

 

Thanks.

Amir

Amir
0 Kudos
Message 3 of 20
(4,184 Views)

Hi Amir,

 

with the TDMS Write.vi you can add Channels and Groups to your TDMS File.

 

The following example write random values in specific groups and channels.

Timestamping Queued Data and Storing in TDMS Files:

https://decibel.ni.com/content/docs/DOC-5789

 

 

_____________________________________________________________________

---Please mark a post as a Solution if it solved your problem ---
0 Kudos
Message 4 of 20
(4,179 Views)

Hi Again,

 

I have cutomized the example for my application. Attached you can find my code. But there is still a problem. At the end of the trial, as set by the total time (sec), the TDMS file does not show all the values, i.e. it is too short. Where are the other values? I thought I saves all data points!

Additionally all the measurements are 0. I have connected it to the clock source but they are all still zero.

 

Thank you for your help.

Amir

Amir
0 Kudos
Message 5 of 20
(4,167 Views)

Hi Amir,

 

 

Remove that 100ms wait vi from 2nd loop and connect 100ms to timeout terminal of dequeue element.

 

I hope that will work.

 

Regards,

Bijay

0 Kudos
Message 6 of 20
(4,148 Views)

Hey,

 

at first please allow debugging in your VI. With debugging you can set probes, which help you understand the function of your VI:

http://digital.ni.com/public.nsf/allkb/22729F1BAC6BBDD086256FDC005FE8FD

 

What clock source do you connect to your Dev1/ctr1? Did you check your clock with a scope?

(Dev1/ctr1 is not the internal clock!)

 

I did some changes in your VI:

 

 

Xenox

_____________________________________________________________________

---Please mark a post as a Solution if it solved your problem ---
Message 7 of 20
(4,144 Views)

Hi xenox,

 

Try this....

Go to VI properties > category Execution >check Allow debugging.

 

Continue with work.

 

Regards,

Bijay

0 Kudos
Message 8 of 20
(4,141 Views)

Hi Bijay,

 

i know Smiley Wink

have a look at my link I posted before:

http://digital.ni.com/public.nsf/allkb/22729F1BAC6BBDD086256FDC005FE8FD

 

 

_____________________________________________________________________

---Please mark a post as a Solution if it solved your problem ---
0 Kudos
Message 9 of 20
(4,138 Views)

Hi Bijay,

 

and thanks for your response. Unfortunately I could not open your example code, since it is written in a higher labview version as mine, which is 8.6. Can you help me with an example that the queue is filled in two different loops. In the example above, all values are stored in a single loop. What if I want to store x value from loop 1 and also store y value from loop 2. can I add them to the same queue? or I have to use another queue?

 

Thanks.

Amir

Amir
0 Kudos
Message 10 of 20
(4,112 Views)