matlab_tdm_example


用Matlab打开tdms文件,为后续数据处理奠定基础。
资源截图
代码片段和文件信息
clc;

%Recreate needed property constants defined in nilibddc_m.h
DDC_FILE_NAME = ‘name‘;
DDC_FILE_DEscriptION = ‘description‘;
DDC_FILE_title = ‘title‘;
DDC_FILE_AUTHOR = ‘author‘;
DDC_FILE_DATETIME = ‘datetime‘;
DDC_CHANNELGROUP_NAME = ‘name‘;
DDC_CHANNELGROUP_DEscriptION = ‘description‘;
DDC_CHANNEL_NAME = ‘name‘;

%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
    [dllfiledllfolder]=uigetfile(‘*dll‘‘Select nilibddc.dll‘);
    libname=strtok(dllfile‘.‘);
    NI_TDM_DLL_Path=fullfile(dllfolderdllfile);
end
if exist(‘NI_TDM_H_Path‘‘var‘)==0
    [hfilehfolder]=uigetfile(‘*h‘‘Select nilibddc_m.h‘);
    NI_TDM_H_Path=fullfile(hfolderhfile);
end

%Prompt the user to browse to the path of the TDM or TDMS file to read
[filepathfilefolder]=uigetfile({‘*.tdm‘;‘*.tdms‘}‘Select a TDM or TDMS file‘);
Data_Path=fullfile(filefolderfilepath);

%Load nilibddc.dll (Always call ‘unloadlibrary(libname)‘ after finished using the library)
loadlibrary(NI_TDM_DLL_PathNI_TDM_H_Path);

%Open the file (Always call ‘DDC_CloseFile‘ when you are finished using a file)
fileIn = 0;
[errdummyVardummyVarfile]=calllib(libname‘DDC_OpenFileEx‘Data_Path‘‘1fileIn);

%Read and display file name property
filenamelenIn = 0;
%Get the length of the ‘DDC_FILE_NAME‘ string property
[errdummyVarfilenamelen]=calllib(libname‘DDC_GetFileStringPropertyLength‘fileDDC_FILE_NAMEfilenamelenIn);
if err==0 %Only proceed if the property is found
    %Initialize a string to the length of the property value
    pfilename=libpointer(‘stringPtr‘blanks(filenamelen));
    [errdummyVarfilename]=calllib(libname‘DDC_GetFileProperty‘fileDDC_FILE_NAMEpfilenamefilenamelen+1);
    setdatatype(filename‘int8Ptr‘1filenamelen);
    disp([‘File Name: ‘ char(filename.Value)]);
end

%Read and display file description property
filedesclenIn = 0;
%Get the length of the ‘DDC_FILE_DEscriptION‘ string property
[errdummyVarfiledesclen]=calllib(libname‘DDC_GetFileStringPropertyLength‘fileDDC_FILE_DEscriptIONfiledesclenIn);
if err==0 %Only proceed if the property is found
    %Initialize a string to the length of the property value
    pfiledesc=libpointer(‘stringPtr‘blanks(filedesclen));
    [errdummyVarfiledesc]=calllib(libname‘DDC_GetFileProperty‘fileDDC_FILE_DEscriptIONpfiledescfiledesclen+1);
    setdatatype(filedesc‘int8Ptr‘1filedesclen);
    disp([‘File Description: ‘ char(filedesc.Value)]);
end

%Read and display file title property
filetitlelenIn = 0;
%Get the length of the ‘DDC_FILE_title‘ string property
[errdummyVarfiletitlelen]=calllib(libname‘DDC_GetFileStringPropertyLength‘fileDDC_FILE_titlefiletitlelenIn);
if err==0 %Only proceed if the property is found
    %Initialize a string to the length of the property value
    pfiletitle=libpointer(‘strin

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledev
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin32-bit
     文件     2306048  2009-10-20 03:48  MATLAB TDM Exampledevin32-bitdacasr.dll
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin32-bitDataModels
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin32-bitDataModelsUSI
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin32-bitDataModelsUSI1_0
     文件       18725  2009-10-20 03:44  MATLAB TDM Exampledevin32-bitDataModelsUSI1_0usi_1_0.xsd
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin32-bitDataModelsUSITDM
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin32-bitDataModelsUSITDM1_0
     文件        6032  2009-10-20 03:44  MATLAB TDM Exampledevin32-bitDataModelsUSITDM1_0USI_TDM_1_0.xml
     文件       24470  2009-10-20 05:16  MATLAB TDM Exampledevin32-bitembeddedUSICopyrights.chm
     文件      839680  2008-10-15 17:03  MATLAB TDM Exampledevin32-bithdf5dll.dll
     文件      143360  2010-01-29 17:51  MATLAB TDM Exampledevin32-bit
ilibddc.dll
     文件      671744  2008-10-16 17:02  MATLAB TDM Exampledevin32-bitstlport.5.0.dll
     文件      516608  2009-05-25 04:32  MATLAB TDM Exampledevin32-bit dms_ebd.dll
     文件      602112  2009-10-20 03:52  MATLAB TDM Exampledevin32-bituds.dll
     文件        2591  2009-04-23 17:02  MATLAB TDM Exampledevin32-bitUSI_STLport_Notice.txt
     文件       11560  2009-04-23 17:02  MATLAB TDM Exampledevin32-bitUSI_Xerces_License.txt
     文件         570  2009-04-23 17:02  MATLAB TDM Exampledevin32-bitUSI_Xerces_Notice.txt
     文件      880640  2009-10-20 03:53  MATLAB TDM Exampledevin32-bitusiEx.dll
     文件      655360  2009-10-20 03:51  MATLAB TDM Exampledevin32-bitusiPluginTDM.dll
     文件      786432  2009-10-20 03:54  MATLAB TDM Exampledevin32-bituspTdms.dll
     文件     1888256  2008-10-15 17:08  MATLAB TDM Exampledevin32-bitxerces-c_2_8_usi.dll
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin64-bit
     文件     3460096  2009-10-20 04:47  MATLAB TDM Exampledevin64-bitdacasr.dll
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin64-bitDataModels
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin64-bitDataModelsUSI
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin64-bitDataModelsUSI1_0
     文件       18725  2009-10-20 03:44  MATLAB TDM Exampledevin64-bitDataModelsUSI1_0usi_1_0.xsd
     目录           0  2010-04-30 17:54  MATLAB TDM Exampledevin64-bitDataModelsUSITDM
............此处省略46个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)