Communication between Matlab and National Instrument card

3 views (last 30 days)
Hello,
I am trying make a communication between Matlab and my NI-USB6221 card.
Here is my Matlab code :
loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni')
taskh1=uint32(1);
[a,b,taskh1] = calllib('myni','DAQmxCreateTask','master',taskh1)
I precise that the files 'nicaiu.dll' and 'nidaqmx.h' are in the Matlab workspace (so I don't have to use addpath). And I don't have Data Acquisition Toolbox.
And this is what I get :
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 381
??? Error using ==> loadlibrary at 461
There was an error loading the library "C:\Documents and
Settings\uidt1982\Desktop\CARTE_NI\nicaiu.dll"
*La procédure spécifiée est introuvable.*
Caused by: Error using ==> loaddefinedlibrary La procédure spécifiée est introuvable.
For the ones who doesn't speak french at all, the sentence in bold means : "the specified procedure cannot be found"
I don't understand this error and I am really stuck...
Some help would be welcome.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 19 Apr 2012
Looks like your header (nidaqmx.h) may be declaring methods that LOADLIBRARY cannot find in the DLL? What do you get in 'warnings' if you try:
>> [notfound,warnings]=loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni')

More Answers (2)

nico974
nico974 on 20 Apr 2012
HI Kaustubha,
Thanks for your help.
You were right, it seems that my library file was not recognized by Matlab.
It works well now.
Kind regards.

Clownfish
Clownfish on 27 Jul 2012
Edited: Walter Roberson on 27 Jul 2012
Hi,
I have Matlab R2012a 32bit and a NI PCI-6229 card.
When I enter the command loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni') I get a hell of Warnings. Seems that Matlab cant load the library.
Any Hints?
Here are the Warnings:
> 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.
> In loadlibrary at 403
Warning: The data type 'FcnPtr' used by function DAQmxRegisterDoneEvent does not exist.
> In loadlibrary at 403
Warning: The data type 'FcnPtr' used by function DAQmxRegisterSignalEvent does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetChanAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetChanAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetTimingAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetTimingAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetTimingAttributeEx does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetTimingAttributeEx does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetTrigAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetTrigAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetReadAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetReadAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetWriteAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetWriteAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetExportedSignalAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetExportedSignalAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetScaleAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetScaleAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetBufferAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetSwitchChanAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetSwitchDeviceAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetSwitchDeviceAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetSwitchScanAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetDeviceAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxCreateWatchdogTimerTask does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetWatchdogAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetWatchdogAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetCalInfoAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetCalInfoAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetPhysicalChanAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetRealTimeAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetRealTimeAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetPersistedTaskAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetPersistedChanAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetPersistedScaleAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetSystemInfoAttribute does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetDigitalPowerUpStates does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetDigitalPowerUpStates does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetDigitalPullUpPullDownStates does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetDigitalPullUpPullDownStates does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxSetAnalogPowerUpStates does not exist.
> In loadlibrary at 403
Warning: The data type 'error' used by function DAQmxGetAnalogPowerUpStates does not exist.
> In loadlibrary at 403

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!