NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Sauvik
Posts: 20
0 Kudos

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

Active Participant
D_Biel
Posts: 640
0 Kudos

Re: How to log the Data Acquisition output to a file?

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
Product Support Engineer
Member
Sauvik
Posts: 20
0 Kudos

Re: How to log the Data Acquisition output to a file?

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

 

 

 

Member
Sauvik
Posts: 20
0 Kudos

Re: How to log the Data Acquisition output to a file?

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

 

 

 

Member
MilanR
Posts: 139
0 Kudos

Re: How to log the Data Acquisition output to a file?

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
Applications Engineering
National Instruments
ni.com/support
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page