Standalone executiable won't work properly

Hi all,
I created a program with a GUI, the goal is to output signals to different devices (3) using a NationalInstruments Data acquisition card.
First thing you have to know is that everything works well when i'm using it INSIDE Matlab. but after compiling with mcc -mv main.m -a *, the standalone .exe don't have the same behaviour.
As an example, The first thing the program have to do is to verify if the device is connected (USB) using a try/catch structure. But even if the device is connected, the program throw me the error message in 'catch'.
In my opinion, there's probably an issue whit the compiler because everything is fine inside Matlab but I wonder what the problem could be...
I'm using Matlab R2012b and compiler version 4.18
Thanks in advance.

4 Kommentare

Friedrich
Friedrich am 8 Apr. 2013
Could you post the lines of code which check for the USB device and the error you get? Also are you using 32bit or 64bit MATLAB?
I'm using 64bit Matlab.
Here there's the 2 first tests of the code:
function myDaq = find_ni_usb_6008
myDaq = [];
try
myDaq = daq.createSession('ni');
catch
h=errordlg('Unable to find any NI-DAQ devices (is the device driver installed?)','Error');
movegui(h,'center');
uiwait(h);
end
try
myDaq.addAnalogInputChannel('dev1','ai0','Voltage');
catch
h=errordlg('Unable to find NI USB-6008 (is it connected to the PC?). Connect it and try again please.','Error');
movegui(h,'center');
uiwait(h);
end
I don't really get an error, but even if the device is installed and connected, I get the error dialog message, this isn't the expected behaviour.
Friedrich
Friedrich am 9 Apr. 2013
Could you remove that try catch so that we see the actual error message matlab provides?
Maxime Jardonnet
Maxime Jardonnet am 9 Apr. 2013
I got this running the .exe (still running well inside matlab) :
Error using find_ni_usb_6008 (line6)
The vendor 'ni' is not known. Use 'daq.getVendors()' for a list of vendors.
daq:general:unknownVendor

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Image Analyst
Image Analyst am 8 Apr. 2013

0 Stimmen

My guess would be that the drivers for the device aren't installed in your target computer. Have you tried everything in the FAQ yet? http://matlab.wikia.com/wiki/FAQ#My_standalone_executable_won.27t_run_on_the_target_computer._What_can_I_try.3F

10 Kommentare

Maxime Jardonnet
Maxime Jardonnet am 8 Apr. 2013
Both programming and target computer have the device driver installed. I can output signals using the device's application.
I'll try the FAQ.
Image Analyst
Image Analyst am 8 Apr. 2013
Dependency Walker will probably locate the problem.
Maxime Jardonnet
Maxime Jardonnet am 9 Apr. 2013
Bearbeitet: Maxime Jardonnet am 9 Apr. 2013
Dependency Walker point out the problem : 4 .dll are missing :
CTFDATAINTERFACES.DLL
CTFPACKAGE.DLL
IESHIMS.DLL
LIBMWI18N.DLL
How can I fix that ?
Friedrich
Friedrich am 9 Apr. 2013
YOu need to make a runtime profile and not a static analysis. Open the exe in DEP WALKER go to profile => start profiling, hit okay. DEP WALKER will start the exe and log all information you need. After that take a look at the output to figure out whats missing. If you are not sure how to interpret the log file, upload it somewhere and post the link here.
Maxime Jardonnet
Maxime Jardonnet am 9 Apr. 2013
I uploaded the log files here:
https://docs.google.com/file/d/0B3x7iP9t_eeLX29VYnp6dnVzbk0/edit?usp=sharing https://docs.google.com/file/d/0B3x7iP9t_eeLaDhoT1VyWUpaQWM/edit?usp=sharing
Friedrich
Friedrich am 9 Apr. 2013
I mean the dependecy walker log file.
Maxime Jardonnet
Maxime Jardonnet am 9 Apr. 2013
You probably talk about this one:
https://docs.google.com/file/d/0B3x7iP9t_eeLbjl1dXl4OHJQRGM/edit?usp=sharing
Friedrich
Friedrich am 9 Apr. 2013
Yes, partly.
Goto SaveAs and save it as .dwi file. upload that one.
Maxime Jardonnet
Maxime Jardonnet am 9 Apr. 2013
https://docs.google.com/file/d/0B3x7iP9t_eeLNnd4N2NiN2dMQTg/edit?usp=sharing
Friedrich
Friedrich am 9 Apr. 2013
Bearbeitet: Friedrich am 9 Apr. 2013
So you posted a crash log also. When does it crash exactly? The DWI file shows an interesting installation path of your 64bit MATLAB:
c:\program files (x86)\matlab\r2012b
Normally 64bit applications are installed into
c:\program files\
Not sure if this may cause any troubles. In addition only one NI DLL shows up which is found:
c:\program files\national instruments\shared\mdns responder\NIMDNSNSP.DLL
I can't spot any other NI file which is looked for.
Maybe compile the daqsupport function into a small exe and run it on that machine to figure out what is missing on the target machine.

Melden Sie sich an, um zu kommentieren.

Sam Walder
Sam Walder am 18 Feb. 2019
Bearbeitet: Sam Walder am 18 Feb. 2019

0 Stimmen

I had the same issue in my application - the DAQ would connect and work in the full Matlab environment, but not in the compiled application. I resolved the issue by making sure to update everything in NI MAX on both the development and deployment machines. I am not sure why this was an issue - but it fixed it for me.
It may be useful to note that there are some similar questions on this topic on the forum:

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 8 Apr. 2013

Bearbeitet:

am 18 Feb. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by