Calling library problem
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Perron Jonathan
el 10 de Mzo. de 2011
Comentada: ludwig law
el 5 de Mayo de 2017
Hello, I am currently working on importation of .tdms files (obtained with Labview) and I'm meeting some scripting problems. Indeed, I was working on a modified version of their "Matlab TDMS example" (that can be found here : http://zone.ni.com/devzone/cda/epd/p/id/5957), and i met the following issue: From the original version, I meet no problem for calling a library, but in my version, I have this message :
??? Error using ==> calllib Library was not found
Error in ==> ReadFile_trololo at 44 [err,dummyVar,dummyVar,file]=calllib(libname,'DDC_OpenFileEx',Data_Path,'',1,fileIn);
Error in ==> run at 57 evalin('caller', [s ';']);
I had understood that my libname variable is not correct, but I don't see how I can fix this issue. For informations here is the original part of the NI file :
%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 [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 [hfile,hfolder]=uigetfile('*h','Select nilibddc_m.h'); NI_TDM_H_Path=fullfile(hfolder,hfile); end
%Prompt the user to browse to the path of the TDM or TDMS file to read [filepath,filefolder]=uigetfile({'*.tdm';'*.tdms'},'Select a TDM or TDMS file'); Data_Path=fullfile(filefolder,filepath);
%Load nilibddc.dll (Always call 'unloadlibrary(libname)' after finished using the library) loadlibrary(NI_TDM_DLL_Path,NI_TDM_H_Path);
%Open the file (Always call 'DDC_CloseFile' when you are finished using a file) fileIn = 0; [err,dummyVar,dummyVar,file]=calllib(libname,'DDC_OpenFileEx',Data_Path,'',1,fileIn);
And here is what I have done :
%Path of the nilibdcc.dll and nilibdcc_m.h Trololopath= 'C:\Program Files\MATLAB\R2010b'; hfile = [Trololopath '\extern\include\nilibddc_m.h']; dllfile = [Trololopath '\bin\win32\nilibddc.dll']; libname=strtok(hfile,'.'); loadlibrary(dllfile, hfile);
% attribution of libname libname=strtok(dllfile,'.');
%Prompt the user to browse to the path of the TDMS file to read [filepath,filefolder]=uigetfile('*.tdms'},'Select a TDMS file'); Data_Path=fullfile(filefolder,filepath);
%Load nilibddc.dll (Always call 'unloadlibrary(libname)' after finished using the library) loadlibrary(dllfile,hfile);
%Open the file (Always call 'DDC_CloseFile' when you are finished using a file) fileIn = 0; [err,dummyVar,dummyVar,file]=calllib(libname,'DDC_OpenFileEx',Data_Path,'',1,fileIn);
0 comentarios
Respuesta aceptada
Kaustubha Govind
el 10 de Mzo. de 2011
Why do you define libname as:
libname=strtok(hfile,'.');
The original code says:
libname=strtok(dllfile,'.');
Más respuestas (1)
Perron Jonathan
el 10 de Mzo. de 2011
1 comentario
Walter Roberson
el 10 de Mzo. de 2011
perhaps you are looking for fileparts() to extract just the name ?
Ver también
Categorías
Más información sobre TDMS Format Files en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!