Why won't my executable run?
Show older comments
I have compiled a collection of Matlab classes functions into an executable to package up control software and a GUI developed in GUIDE. The executable causes no errors, but does not run. I have installed the MCR. How can I start to investigate problems? Run from the command line? I'm using version R2012B 32 Bit.
Answers (1)
Image Analyst
on 4 Jun 2015
See the FAQ: http://matlab.wikia.com/wiki/FAQ#My_standalone_executable_won.27t_run_on_the_target_computer._What_can_I_try.3F
One thing not on the FAQ yet, is to run the app from a console window so you can see the error. Otherwise if you just double click the icon and you get unhandled errors, everything vanishes. Below is a nice registry change that will add a "Run MS-DOS Prompt here" to your right-click context menu so that you can just right click on a folder and get a DOS window right there rather than have to CD a bunch of times. If you have windows, take this code and put it into a file called RunMSDOSPromptHere.reg and then double click on it.
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\Shell\DosPrompt]
@="Run MS-DOS Prompt here"
[HKEY_CLASSES_ROOT\Directory\Shell\DosPrompt\Command]
@="Cmd /k CD \"%L\" "
Say Yes and OK and then you will be able to get a console window right at the folder you need. Then type in the name of your app and see all the stuff it spews out, including any error messages. Now they won't disappear and you can see what went wrong.
13 Comments
Nicholas
on 22 Jun 2015
Image Analyst
on 22 Jun 2015
I don't think so, because you say it runs from the MATLAB development environment, just not from a compiled executable. It sounds like that kind of error would happen even in the MATLAB development environment, but I could be wrong.
Are you sure you ran dependency walker on your executable? What red or yellow items did you see?
I'm stumped - you'll probably have to call tech support. Though if you get tech support I think you might have to upgrade to the latest version, which would actually be a good idea anyway.
Nicholas
on 23 Jun 2015
Nicholas
on 23 Jun 2015
Image Analyst
on 23 Jun 2015
Since you've already started a case on this with the Mathworks, have them carry it through to the final resolution. Better yet, use this as a reason for your boss to buy you the latest version of MATLAB without the bug.
Nicholas
on 23 Jun 2015
Image Analyst
on 23 Jun 2015
I have used the compiler with all versions since R2006. I use it with cameras attached. But I have never used the particular "NIUSB board" that you have, or the Data Acquisition Toolbox.
Walter Roberson
on 23 Jun 2015
For example instead of
handles.getioboard.getvendor()
you could code
handles(1).getioboard(1).getvendor()
Even when there is only one member of the structure array, the additional hint to access the first member makes it easier on code generation as the code does not have to worry about the possibility that it is being expected to produce a list.
Image Analyst
on 29 Jun 2015
Nicholas, I've have several apps that use structures and have compiled them in all releases for nearly a decade. I've never had a problem with using structures in a compiled standalone program under Windows. The handles variable in GUIDE is a structure, so they wouldn't release a version of MATLAB if it didn't work with GUIDE, which requires structures.
Nicholas
on 1 Jul 2015
Image Analyst
on 1 Jul 2015
I don't know. Call them and ask.
Categories
Find more on Construct and Work with Object Arrays 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!