Why won't my executable run?

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)

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

I ran the code from the command line, and got a "dotRefOnNonScalar" error when I am instantiating a NIUSB board object. Is it possible that my version of the compiler is not compatible with the newer session based interface for the data acquisition toolbox? I am using the R2012 V8.0 mcr.
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.
What is the "dependency walker"?
Nicholas
Nicholas on 23 Jun 2015
Edited: Nicholas on 23 Jun 2015
This is a screen shot of the error message in the command line and the line of code that is causing the error.
I've been speaking with people from Matlab, they are saying this is a known bug in r2012b. They say I have to use "indexing" notation to access the structure. Can anybody show me what this looks like for multidimensional structs? Don't I have to use the dot operator eventually?
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.
Have you ever used the compiler with this version of Matlab? It seems like it would be a HUGE problem.
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.
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.
Nicholas
Nicholas on 29 Jun 2015
Edited: Nicholas on 29 Jun 2015
Walter,
Thanks for the response. Instead of the dot operator on a scalar message, I get a message about bad indexing when I use that syntax. Is there really a huge hole in the compiler from that year? Is it really incapable of parsing a struct? The code runs from the matlab IDE just fine, either way. I even tried hard coding the result of handles.getiobard.getvendor(), as "ni", and I then recieved an error that it was an invalid vendor type. The result of handles.getioboard.getvendor() is exactly "ni"! I'm at my wits end. The MATLAB representative hasn't been able to diagnose it either. Surely somebody out there compiled structs with this version of MATLAB years ago. I'm working on updating my version to try to sidestep it all, but that will take quite some time where I work.
I greatly appreciate all the responses.
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.
Precisely. I'm starting to wonder if it's an issue with subclass/superclass inheritance. Do you know if that compiler handles inheritance of user defined classes?
I don't know. Call them and ask.

Sign in to comment.

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Products

Asked:

on 4 Jun 2015

Commented:

on 1 Jul 2015

Community Treasure Hunt

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

Start Hunting!