Communication between Matlab and National Instrument card

3 次查看(过去 30 天)
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.

采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-4-19
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')

更多回答(2 个)

nico974
nico974 2012-4-20
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 2012-7-27
编辑:Walter Roberson 2012-7-27
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

类别

Help CenterFile Exchange 中查找有关 LabVIEW 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by