Reading TDM/TDMS Files with The MathWorks, Inc. MATLAB® Software

Publish Date: Apr 29, 2019 | 40 Ratings | 1.98 out of 5 | Print | 22 Customer Reviews | Submit your review

The TDM MATLAB Example shows how to read TDM and TDMS files from within the MATLAB® from THE MathWorks software environment.

Supported Features:

  • Consists of TDM C DLL and adapted C-header file (nilibddc_m.h) to be used in conjunction with MATLAB®

FILE EXTENSION: *.TDM; *.TDMS

DIRECTION: Read / ----

LAST CHANGE: May, 2010

Installation Instructions

  1. Download the attached zip file referenced in this document titled MATLAB-TDM-Example.zip.
  2. Unzip the downloaded zip file MATLAB-TDM-Example.zip
  3. Examine the folder “Examples”

If you copy the TDM dll and the header file into "C:\test\", you must specify the location in your m-script like this:

examplePath = 'C:\test';
hfile = [examplePath '\nilibddc_m.h'];
loadlibrary([examplePath '\nilibddc'], hfile);

Keep in mind that this provides only the capability to read TDM/TDMS files with the MATLAB® software environment and that the example has been tested with MATLAB® Versions R2007a, R2007b, and R2008a.  It is expected that the example will work with earlier versions as well.

Important: Please follow the licensing and installation instructions in the files license.rtf and Readme.txt which are part of this download.

MATLAB® is a registered trademark of The MathWorks, Inc.

Related Links

DataPlugins: Supported Data Formats

Back to Top

Customer Reviews
22 Reviews | Submit your review

No information about how to change the header  - Jul 25, 2017

It is impossible to find documentation about how to define the header or modify the .m file in case other files or type of data (like float) is created. It works perfectly with the example only.

Error using R2017a  - Jul 12, 2017

I am using R2017a. I can run the sine example just fine, but when I try to run a .tdms file, I get the following error: The datatype and size of the value must be defined before the value can be retrieved. Error in ReadFile (line 57) disp(['File Description: ' char(filedesc.Value)]); My guess is that this is due to the version I am using. Any ideas for work-arounds?

TDMS support for Matlab on Mac OS  - Jun 27, 2017

User built TDMS converter tools have been used to convert TDMS files to MAT for use in Matlab, but are not consistent with results. This utility is built on libraries which should be more robust, but these libraries are built on Windows platforms. Can you provide the libraries to be able to run the TDMS conversion on a Mac OS?

Error with MATLAB 2016b  - Jan 13, 2017

While I have used this code framework with no errors for several years, the new release of MATLAB 2016b causes an error. "Error using loadlibrary C:\Users\...\AppData\Local\Temp\tpef7e8dbb_6903_421f_93f6_625238e761b7\nilibddc_thunk_pcwin64.dll is not a valid Win32 application." I returned to my installation of 2016a and it works fine. I have tried to troubleshoot, but haven't found a solution.

I have the same error in matlab 2015 ,MATLAB R2015a 64bit. “nilibddc_m” nor “nilibddc_m.h” are not defined. How can I resolve the problem?   - Sep 1, 2016

Running the example on MATLAB R2015a 64-bit and getting the following errors: Index exceeds matrix dimensions. Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 527) Error in loadlibrary (line 263) Error in ReadFile (line 30) loadlibrary(NI_TDM_DLL_Path,NI_TDM_H_Path); Any suggestions?

Error  - Apr 6, 2016

MATLAB R2015a 64bit. “nilibddc_m” nor “nilibddc_m.h” are not defined. How can I resolve the problem?

Getting errors  - May 12, 2015

Running the example on MATLAB R2015a 64-bit and getting the following errors: Index exceeds matrix dimensions. Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 527) Error in loadlibrary (line 263) Error in ReadFile (line 30) loadlibrary(NI_TDM_DLL_Path,NI_TDM_H_Path); Any suggestions?

I cant run the example successfully  - Oct 27, 2014

Hi, I cant run the example successfully, it is said 'Index exceeds matrix dimensions. Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 520)', 'Error in loadlibrary (line 263)', and I dont know what is wrong, I just download the example zip and run it...thank you very much.

  - Dec 22, 2013

How to Resolve Library Loading Error If you are receiving this error: " Error using ==> loadlibrary at 279 Microsoft Visual C++ 2005 or 2008 is required to use this feature. Error in ==> ReadFile at 30 loadlibrary (NI_TDM_DLL_Path,NI_TDM_ H_Path); " All you have to do is type into the Matlab command prompt "mex - setup" and select an installed compiler, then run the "ReadFile" Matlab script and the sinedata should plot correctly. - Randy Schiffer, University of Michigan. blitzcrege@yahoo.com - Aug 3, 2012 I have had library loading problem. Error message mentioned above. I have tried "mex-setup" command and seleted one of the available compilers. But there is still the same error message. I am running MATLAB 7.10.0(R2010a). My computer is Win8

  - May 16, 2013

How to Resolve Library Loading Error If you are receiving this error: " Error using ==> loadlibrary at 279 Microsoft Visual C++ 2005 or 2008 is required to use this feature. Error in ==> ReadFile at 30 loadlibrary (NI_TDM_DLL_Path,NI_TDM_ H_Path); " All you have to do is type into the Matlab command prompt "mex -setup" and select an installed compiler, then run the "ReadFile" Matlab script and the sinedata should plot correctly. - Randy Schiffer, University of Michigan. blitzcrege@yahoo.com - Aug 3, 2012 I have had library loading problem. Error message mentioned above. I have tried "mex-setup" command and seleted one of the available compilers. But there is still the same error message. I am running MATLAB 7.8.0(R2009a). My computer is Win7 Enterprise SP1

Doesn't work outside C-drive  - Oct 25, 2012

I am trying this with Matlab 2009bSP1 on Windows XP SP3. it works as long as the dll and h-files are on the C-drive but if I move it to a network drive it doesn't work anymore. I get the following error message: >> loadlibrary('R:\xxx\tdm\dev\bin\32-bit\nilibddc.dll','R:\xxx\dev\include\32-bit\nilibddc_m.h') ??? Error using ==> loadlibrary at 474 There was an error loading the library "R:\xxx\dev\bin\32-bit\nilibddc.dll" This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Caused by: Error using ==> loaddefinedlibrary This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

How to Resolve Library Loading Error  - Aug 3, 2012

If you are receiving this error: " Error using ==> loadlibrary at 279 Microsoft Visual C++ 2005 or 2008 is required to use this feature. Error in ==> ReadFile at 30 loadlibrary (NI_TDM_DLL_Path,NI_TDM_ H_Path); " All you have to do is type into the Matlab command prompt "mex -setup" and select an installed compiler, then run the "ReadFile" Matlab script and the sinedata should plot correctly.

  - May 13, 2012

In response to 64-bit MATLAB problem This does not appear to work with 64-bit MATLAB. "??? Error using ==> loadlibrary at 279 Microsoft Visual C++ 2005 or 2008 is required to use this feature. Error in ==> ReadFile at 30 loadlibrary(NI_TDM_DLL_Path,NI_TDM_ H_Path);" Is there a solution? - Jan 5, 2011 How to rectify this..i already have Microsoft Visual C++ 2005 & 2008 but still getting the same error..

  - Nov 30, 2011

I got errors initially as the paths to nilibddc.dll and nilibddc_m.h were wrong. But they existed so the code to let you pick them wasn't triggered. Modifying "ReadFile.m" to let you pick the file locations if had short paths worked for me: %Check if the paths to 'nilibddc.dll' and 'nilibddc_m.h' have been %selected. If not, prompt the user to browse to each of the files. if exist('NI_TDM_DLL_Path','var')==0 || length(NI_TDM_DLL_Path)<4, [dllfile,dllfolder]=uigetfile('*dll','Select nilibddc.dll'); libname=strtok(dllfile,'.'); NI_TDM_DLL_Path=fullfile(dllfolder,dllfile); end if exist('NI_TDM_H_Path','var')==0 || length(NI_TDM_H_Path)<4, [hfile,hfolder]=uigetfile('*h','Select nilibddc_m.h'); NI_TDM_H_Path=fullfile(hfolder,hfile); end Putting them in the path might also work

  - Jun 17, 2011

This worked well with 32-bit Windows XP, but I can't get it to work with 64-bit Windows 7 + 64-bit Matlab R2010b. I used the 64-bit files. Error message is about needing Visual C++ 05 or 08, but I do have the 64-bit VC++ 2008 runtime installed.

Failed to preprocess the input file.  - Apr 25, 2011

I attempted to read in the <SineData.tdm> file and got this message: "??? Error using ==> loadlibrary at 367 Failed to preprocess the input file. Output from preprocessor is:'cl' is not recognized as an internal or external command, operable program or batch file." What do I need to do to fix this problem?

64-bit MATLAB problem  - Jan 5, 2011

This does not appear to work with 64-bit MATLAB. "??? Error using ==> loadlibrary at 279 Microsoft Visual C++ 2005 or 2008 is required to use this feature. Error in ==> ReadFile at 30 loadlibrary(NI_TDM_DLL_Path,NI_TDM_ H_Path);" Is there a solution?

TDM DLL Documentation  - Nov 19, 2010

The example m-script only deals with double values, but the DLL is not limited, and is documented here. http://zone.ni.com/reference/en- XX/help/370051P-01/TOC85.htm

MAC  - Nov 5, 2010

As a novice with this type of thing, I tried to install it on a mac and see if I could work around it. First problem was the uigetfile and line 2, had to eliminate .tdms and .tdm with just a '*' Second problem, had to reroute the TDMSPath command and hfile, and load library on lines 16, 17, 18. Changed them to a matlab folder within documents, and installed the nilibddc_m.h and nilibddc.dll within this folder. Things appear to execute initially, and then it terminates with the following: Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(...) > In loadlibrary at 394 Error loading library intermediate output follows. The actual error is at the end of this output. ********* Type '__builtin_va_list' was not found. Defaulting to type error. Found on line 8 of input from line 43 of file /usr/lib/gcc/i686-apple- darwin10/4.2.1/include/stdarg.h

TDM Matlab Mac  - Jul 28, 2010

Is there an equivalent package/code that will allow me to read a TDM/TDMS file with Matlab on a Mac (64 bit)?

strings in Channels  - Jan 26, 2010

Hello, got anybody this example working with string values in the data channels?

Limited to datatype double, fixed to read int16 data:  - Oct 30, 2009

As built example only reads type double data. I got it to read type int16 data with a little intuitive/ lucky undocumented sytax guessing. It would be nice if the developers would complete this job!!! %Look for this secion in matlab read example %Get Channel Value if Data Type is 'Double'(10) if ptype.Value==10 pnumvals=libpointer('uint64Ptr',0); calllib('nilibddc','DDC_GetNumDataValues',pchans.Value(j),pnumvals); pvals=libpointer('doublePtr',zeros(1,pnumvals.Value)); calllib('nilibddc','DDC_GetDataValues',pchans.Value(j),0,pnumvals.Value,pvals); chanvals(:,j)=(pvals.Value)'; %#ok<AGROW> end %as a hack to add type int16 add the following %Get Channel Value if Data Type is 'int16'(2) if ptype.Value==10 pnumvals=libpointer('uint64Ptr',0); calllib('nilibddc','DDC_GetNumDataValues',pchans.Value(j),pnumvals); pvals=libpointer('int16Ptr',zeros(1,pnumvals.Value)); calllib('nilibddc','DDC_GetDataValues',pchans.Value(j),0,pnumvals.Value,pvals); chanvals(:,j)=(pvals.Value)'; %#ok<AGROW> end %good luck :)

View more reviews

Bookmark & Share


Downloads


Ratings

Rate this document

Answered Your Question?
Yes No

Submit