RAW NI TDMS file reader
% This function uses NI TDM/TDMS C DLL interface to read TDMS file directly
% from MATLAB, without using NI softwares. Note that it reads the 'raw'
% tdms files, not the processed tdms files. The algorithm is exactly the
% same as the ones used in NI-provided examples, except some convenience
% features. Thus this is not really an original implementation, but only
% provides information about how to set the DLL interface properly, and a
% few simplifications. Thus it does not provide advanced functions. You
% should study C functions yourself for that purpose.
%
% To use this function, you MUST do three things.
%
% 1. Install NI TDM/TDMS C libray for Matlab. (Just extract a
% compressed file into a folder of your choice.)
% http://www.ni.com/example/30957/en/
%
% 2. Setup mex compiler. ("mex -setup")
% Without compiler setup, "loadlibrary" does not work properly.
% For 32-bit, you can simply install Microsoft VisualStudio Express as a
% free compiler. For 64-bit, you may install Microsoft Software
% Development Kit for free (not tested). See Matlab support page for
% supported compilers of your Matlab version. After installing you choice
% of compiler, run "mex -setup". Then you can use this function to read
% TDMS files. This function was tested under Matlab 2013b, Microsoft
% Visual Studio Professional 2012 for 64bit, Microsoft Visual Studio
% Express for 32bit.
%
% 3. Set proper path for the following variable, DEV_ROOT.
% Note that the architecture is automatically determined. The purpose is
% to properly set NI_TDM_DLL_Path and NI_TDM_H_Path for the
% 'loadlibrary' function.
%
% example:
% >> data = readTDMS('abc.tdms');
%
% Disclaimer: This function is not original at all. It is slight
% modification of the original example provided by NI. I only made the use
% a bit simpler, with clear instruction of how to set it up. Also, it does
% not provide advanced TDMS read/write or manipulation. You should understand
% TDM/TDMS C library for that. Finally, according to NI license agreement,
% if you include TDM/TDMS C DLL in your product distribution, you must
% implement 'writing' functions as well. See the NI license agreement.
%
%