06-27-2012 06:03 PM
Hi,
When I want to load 'NIDAQmx.h' in matlabusing this command
loadlibrary('nicaiu.dll','NIDAQmx.h','alias','myni')
I encounter the following Warning and Error:
Warning: Warnings messages were produced while parsing. Check the functions you intend to use for
correctness. Warning text can be viewed using:
[notfound,warnings]=loadlibrary(...)
> In loadlibrary at 344
Warning: The data type 'error' used by function DAQmxGetTaskAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'FcnPtr' used by function DAQmxRegisterEveryNSamplesEvent does not exist.
.
.
.
I have put both 'nicaiu.dll' and 'NIDAQmx.h' in the same folder that I am running my m-file. And I have added it to my Matlab path. I also have downloaded Windows SDK 7.1 for compiling Mex files and Perl software as is mentioned in the "loadlibrary" function help of Matlab. All the matlab Help examples for "loadlibrary" are working good without any warning. But I am stuck with loading NIDAQmx. I am stucked with this.
PS: I am using a R2012a 32 bit matlab on a 32 bit Windows 7 OS.
I would be really appreciative if you guys can help me in this.
06-28-2012 06:35 PM
Lissa,
I don't normally support MATLAB with our cards. My expertise is mainly geared for LabVIEW. Are you aware of the Data Acquisition Toolbox that MathWorks has available for use with a variety of our cards?
http://www.mathworks.com/products/daq/
This could be a easier way to interface to allow you to perform data acquisition.
Could you post some of your references that you are following and I can see if I can help out in anyway?
I found this forum that originally references this command but I can't find an exact step by step on how to setup MATLAB to interface call into the DLL other than the loadlibrary function. I'm unsure if moving the dll's is required but that could be why it is throwing the errors since you moved the dll's.
http://forums.ni.com/t5/Multifunction-DAQ/Use-M-Series-cards-with-DAQmx-in-Matlab/td-p/185232
07-05-2012 08:56 AM
Thanks for the response.
My 32 bit Matlab 2012a also has the Data Aquisition Toolbox. But I want to use the hardvare timing. I have put nicaiu.dll and NIDAQmx.h in the same folder that I am running my m-file. And this code should work:
loadlibrary('nicaiu.dll','NIDAQmx.h','alias','myni') or [funclist warning] = loadlibrary('nicaiu.dll','NIDAQmx.h','alias','myni')
But it does not work! I looked at many forums through the web but I did not find any answer. I first installed NIDAQmx 9.5.1 which was the last version. Now I downgrade it to NIDAQmx 9.3.5 which came as a DVD with my NI-USB-6501 board. Nothing changed about loading error. I also removed the 'nicaiu.dll' copy from my Matlab path (Current Folder) but nothing did change.
I would really appreciate if you can help me.
07-06-2012 02:08 PM
Lissa,
Unfortunately, I was unable to find a way to import the library into matlab. The library is originally written for C and not for specific use with MATLAB. Though it does appear some customer have gotten it to work I'm unaware of the full requirements to use the library in this way.
I do have two alternatives that should work. You could interface with the DAQ card in C and create a dll that you could call in MATLAB, or you could do the same in LabVIEW. This will allow you to set up the hardware timing that you want but exporting the data to MATLAB.
You may have better luck posting to the MATLAB forums since this is an issue call our dll, which works in the designed use, but isn't calling correctly into another environment.
MATLAB® and Simulink® are registered trademarks of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.
Have a great day.
02-15-2013 01:34 AM - edited 02-15-2013 01:35 AM
Silly question, but have you tried to access the card regardless of the warnings?
I also get a heapload of errors when I first load the dll file (nicaiu.dll) but I can still use the rest of the driver dll. I'm lucky that I don't need any of the "faulty" functions to do what I want.
Some of those faults are hard to get around, Matlab (or loadlibrary in Matlab) do not support data type "FcnPtr" at all so those functions will not work whatever you do. They need a new driver or Matlab revision, or something... I don't know what data type "error" is, maybe it is easily fixed by adding something (a .h-file link?) in NIDAQmx.h. I haven't explored this further, since I could get the driver to work for me doing what I wanted.
Regarding Data Acquisition Toolbox I can say that it really is easy to use, but the functionality is sadly lacking. There is for example no way for me to get the hardware filters working on my card (PCI 6602).