Trouble compiling GUI from figure

2 次查看(过去 30 天)
I have written a UI using the figure function. The UI as well as associated controls, and data are encapsulated in a class. In previous version of MATLAB, I compiled with the following at the command line: "mcc -m filename.m" where filename.m is the class file in which the GUI is defined/coded. Compiling in 2023A yields an executable that when run opens a command line interface which then closes almost immediately.
Running on Windows 10 Enterprise.

采纳的回答

Image Analyst
Image Analyst 2023-11-16
It should run on your computer, so I'm assuming this is what happens on a different computer that you've deployed it to. If that happens, the most likely reason is they don't have the MCR corresponding to the version you compiled it with. To get the error message and not have the window vanich immediately, get a console window (DOS prompt) and type in the name of your program. Any error message should appear and remain. The window will not close because you opened it separately. Make sure you've changed directory so that you're in the directory with your executable.
To make it easy, if you have Windows, you can add an entry to the context menu so that you can browse there with FIle Explorer and then right click and select "Run DOS Prompt Here". Take these lines
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\Shell\DosPrompt]
@="Run MS-DOS Prompt here"
[HKEY_CLASSES_ROOT\Directory\Shell\DosPrompt\Command]
@="Cmd /k CD \"%L\" "
and open a text file and copy them into it, then save it (anywhere) as "Dos Prompt Here.reg". Then double click that file and tell it to make the change to the registry. Then you can just browse to the folder and right click on the yellow folder icon to open a console window there. It's much easier than using CD a bunch of times to get to the folder you need to be in.
Anyway, what do you see in the console window when you try to run your program?
To get the correct MCR on the computer where your executable is installed on, download it from here:
  3 个评论
Joel Marchand
Joel Marchand 2023-11-16
This was a compilation issue. The problem is fixed.
Image Analyst
Image Analyst 2023-11-16
I'm glad my suggestion of shwoing you how you can see the error message in the console window helped you discover the actual error and find a fix for it.
If this Answer helped solve your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by