loadlibrary works on 32 bit but not 64 bit MATLAB

11 views (last 30 days)
I am trying to load a set of dlls from National Instruments in MATLAB so that I can interface with the National Instruments DAQ card through MATLAB. This has worked in the past using 32 bit MATLAB (on a 64 bit machine) however it is not working on 64 bit MATLAB. How can I fix this?
I am running the following command: funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni');
and get the following error:
"Error using loadlibrary There was an error loading the library "C:\Users\ecating\Documents\MATLAB\Version_1\V1_scripts_DoNotDelete\NI_DAQ_scriptsAndInfo\nicaiu.dll" C:\Users\ecating\Documents\MATLAB\Version_1\V1_scripts_DoNotDelete\NI_DAQ_scriptsAndInfo\nicaiu.dll is not a valid Win32 application.
Error in c_PCIE6321 (line 55) funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni');
Caused by: Error using loaddefinedlibrary C:\Users\ecating\Documents\MATLAB\Version_1\V1_scripts_DoNotDelete\NI_DAQ_scriptsAndInfo\nicaiu.dll is not a valid Win32 application."
I am running MATLAB 2016b (version 9.1) on Windows 10.

Answers (1)

Varun Gunda
Varun Gunda on 6 Apr 2017
The "is not a valid Win32 application" error usually means that you are attempting to load a 32-bit DLL using 64-bit MATLAB. Check if there are 64-bit versions of the NI DLLs available and download them. Or You can try installing 32-bit MATLAB on your 64-bit machine and use them as you were doing previously.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!