MATLAB: Do I receive the warning “The device adaptor is not in the expected location” when using the Data Acquisition Toolbox

adaptordaqregisterData Acquisition Toolboxnidaq

Why do I receive the following warning when I run my code that uses the Data Acquisition Toolbox?
 
daqreset
dio = digitalio('nidaq','Dev1');
d0 = addline(dio,0,'out');
d1 = addline(dio,1,'out');
Warning: The device adaptor is not in the expected location.
Expected: C:\Program Files (x86)\MATLAB\R2011b
Actual: C:\Program Files (x86)\MATLAB\R2014b\toolbox\daq\daq\private\mwnidaqmx.dll
An adaptor from the wrong release may be in use. To correct this problem execute:
daqregister('nidaq','unload')
Then exit and restart MATLAB.
When I try to run daqregister('nidaq','unload'), as suggested by the message, I received the following warning:
 
Warning: Unable to self unregister adaptor. Manually removing from registry
> In daqregister>localDaqRegister at 160
In daqregister>localDaqRegister at 104
In daqregister at 50
Warning: Unable to self unregister adaptor. Manually removing from registry
> In daqregister>localDaqRegister at 160
In daqregister at 50

Best Answer

This warning can occur if the "mwnidaqmx.dll" adaptor is not properly registered with Windows.
In order to properly register the adaptor, the MATLAB process needs to be run with administrative privileges.
To register the adaptor, use the following steps:
1) Close all open instances of MATLAB
2) Right-click on the MATLAB shortcut or the file MATLAB.exe and select "Run as Administrator"
3) Once MATLAB starts, execute the following MATLAB commands:
>> rehash toolboxcache 
>> daqreset 
>> daqregister('nidaq')
4) Close and re-open MATLAB.