资源简介
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_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论