资源简介
function BackData = ReadTDMSData(ChanNum,StartNum,NumToGet,filefolder,filepath)
%参数依次为:通道号/开始数据号/结束数据号/文件路径/文件名
对NI官方给出的函数做了修改,直接返回数据值。需要放在ni官方文档中运行,需要改nilibddc.dll和nilibddc_m.h路径
代码片段和文件信息
function BackData = ReadTDMSData(ChanNumStartNumNumToGetfilefolderfilepath)
%参数依次为:通道号/开始数据号/结束数据号/文件路径/文件名
%导入库和文件
%NilibddcLibInit(filefolderfilepath);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%调nilibddc库文件,读入数据文件%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%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‘);
dllfile=‘nilibddc.dll‘;
dllfolder=‘F:\MATLAB Program\Program\MATLAB_TDM_Example\dev\bin\64-bit‘;
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‘);
hfile=‘nilibddc_m.h‘;
hfolder =‘F:\MATLAB Program\Program\MATLAB_TDM_Example\dev\include\64-bit‘;
NI_TDM_H_Path=fullfile(hfolderhfile);
end
%Prompt the user to browse to the path of the TDM or TDMS file to read
if isa(filepath‘numeric‘) && isa(filefolder‘numeric‘)
if filepath == 0 && filefolder == 0
[filepathfilefolder]=uigetfile({‘*.tdms‘;‘*.tdm‘}‘Select a TDM or TDMS file‘);
end
end
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);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%获取组数,并对组赋句柄值%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Get channel groups
%Get the number of channel groups
numgrpsIn = 0;
[errnumgrps]=calllib(libname‘DDC_GetNumChannelGroups‘filenumgrpsIn);
%Get channel groups only if the number of channel groups is greater than zero
if numgrps>0
%Initialize an array to hold the desired number of groups
pgrps=libpointer(‘int64Ptr‘zeros(1numgrps));
[errgrps]=calllib(libname‘DDC_GetChannelGroups‘filepgrpsnumgrps); %得到不同组的句柄值
end
%%%%%%%%%这段为了获取numchans%%%%%%%%%%%
numchansIn = 0;
[errnumchans]=calllib(libname‘DDC_GetNumChannels‘grps(1)numchansIn);
numgv = zeros(numgrpsnumchans);
fo
相关资源
- 中心差分格式的数值试验含MATLAB源码
- 用matlab实现自适应图像阈值分割最大
- 基于matlab灰色模型GM(1,1)预测数据
- matlab100篇经典
- KL距离matlab实现
- 共轭梯度法的matlab程序
- matlab中hanning汉宁窗设计数字高通滤波
- matlab中低通IIR巴特沃斯滤波器的设计
- 最有潮流计算程序matlab
- 热电联产CGAM问题建模
- 根据四张纸牌计算24matlab程序
- 小波矩特征提取matlab代码
- 画标注框(matlab程序)
- 血管的三维重建
- 数字图像处理MATLAB2015版 源代码
- 读取DICOM数据,并截图
- MATLAB复杂网络工具箱使用手册
- MATLAB-BOXFILTER
- matlab MMN排队源文件
- 发动机万有特性制作程序MATLAB
- 惯性导航仿真实现源代码
- 小波变换的图像去噪的matlab程序的源
- 多目标粒子群优化算法MATLAB
- 基于matlab的彩色图像的分割算法
- GPS L5软件MATLAB仿真接收机,根据经典
- 2份BPSK调制解调仿真的MATLAB代码,其中
- LDPC仿真,matlab BP算法 LDPC编解码的m
- LDPC编译码MATLAB程序,可以直接运行程
- 多进制纠错码LDPC编译码matlab算法仿真
- 一个OFDM通信系统的完整仿真MATLAB程序
评论
共有 条评论