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.

답변 (1개)

Image Analyst
Image Analyst 2015년 6월 4일

0 개 추천

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

Nicholas
Nicholas 2015년 6월 22일
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.
Image Analyst
Image Analyst 2015년 6월 22일
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
Nicholas 2015년 6월 23일
What is the "dependency walker"?
Nicholas
Nicholas 2015년 6월 23일
편집: Nicholas 2015년 6월 23일
This is a screen shot of the error message in the command line and the line of code that is causing the error.
Nicholas
Nicholas 2015년 6월 23일
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?
Image Analyst
Image Analyst 2015년 6월 23일
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
Nicholas 2015년 6월 23일
Have you ever used the compiler with this version of Matlab? It seems like it would be a HUGE problem.
Image Analyst
Image Analyst 2015년 6월 23일
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 2015년 6월 29일
편집: Nicholas 2015년 6월 29일
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.
Image Analyst
Image Analyst 2015년 6월 29일
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
Nicholas 2015년 7월 1일
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?
Image Analyst
Image Analyst 2015년 7월 1일
I don't know. Call them and ask.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

질문:

2015년 6월 4일

댓글:

2015년 7월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by