Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to log the Data Acquisition output to a file?

Hi,

 

We are from Oklahoma State University, working on a Data Acquisition Project.

 

We are trying to do Data Acquisition through the NI 9234. We are using a C code related to the DAQ-mx driver, instead of the LabVIEW. 

 

We want to save the acquired data to a file & print it by this program. However, as of now we are not able to do it. I am attaching the Program & the screen-shot of the current output that we are getting from the program.

 

It would be great if anyone can show how to log the acquired data into a file for further use.

 

Thanks,

Sauvik Das Gupta

Download All
0 Kudos
Message 1 of 5
(7,101 Views)

One way to do it is with TDMS logging. DAQmx comes with functions designed to log to a TDMS file. This is a special file type that is used for collecting data in a logical format. It can be displayed in a TDMS viewer where data is separated into groups and channels. NI-DAQmx provides examples for how to log to TDMS. Look at the TDMS examples in the C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage directory.

National Instruments
0 Kudos
Message 2 of 5
(7,089 Views)

Hi, 

 

I looked into the TDMS File Examples. I have worked on TDMS files before, & I know how they work.

 

I also wanted to know instead of saving the data acquired into a file & then post-process it, is there a way we can stream the data being acquired in real-time to a PC & work on the data in real-time?

 

We want to avoid the offline processing involving a file in between & do a real-time online processing instead.

 

Thanks,

Sauvik das Gupta

 

 

 

0 Kudos
Message 3 of 5
(7,084 Views)

Hi,

 

I wanted to save data acquired from NI-DAQ (for example, NI 9234) in a file using the DAQ-mx ANSI C Code. The response I got was as follows:-

 

One way to do it is with TDMS logging. DAQmx comes with functions designed to log to a TDMS file. This is a special file type that is used for collecting data in a logical format. It can be displayed in a TDMS viewer where data is separated into groups and channels. NI-DAQmx provides examples for how to log to TDMS. Look at the TDMS examples in the C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage directory.

 

However, now I want to know is there a way that using that same C code, can we save the data in a .txt file format (Text File) instead of a TDMS file? We actually want to access that file through MATLAB (that's why we want to save it in text format).

 

Also on an other note, is there a way we can access & open TDMS files by MATLAB?

 

Thanks,

Sauvik Das Gupta

 

 

 

0 Kudos
Message 4 of 5
(7,053 Views)

Hi Sauvik,

 

Using the TDMS file save capabilities of the DAQmx drivers is a useful feature because it enables well-performing file saves during data acquisition.

 

The simplest option that involves no modification of your c-code would be to use the TDM Excel Add-In for Microsoft Excel to change file formats. Once the data is loaded into Excel it can be saved into a tab-delimited text file or comma separated values (csv) file capable of being imported into other programs.


Milan
0 Kudos
Message 5 of 5
(7,043 Views)