Some button in standalone app not working after being compiled (although code working well)

15 ビュー (過去 30 日間)
Hi Community,
As in the title, we made an app using Matlab 2019b and I compiled it to be a standalone app.
Although the code works well (in Matlab 2019b), a certain button doesn't work after being compiled to be a standalone app. That is, if I'm using code, I push the button and the corresponding function runs; But if I use the standalone app I generated and push the button, nothing just happen.
I've checked that
  • My Matlab runtime is R2019b (the runtime was installed while I'm installing the app)
  • I do included all files in the list for compiling.
Any hint for the potential reason is high appreciated!
  3 件のコメント
Image Analyst
Image Analyst 2022 年 5 月 10 日
Set breakpoints and see where it gets to. Also, why are you assigning msg and never using it? Can you attach the whole .mlapp file?



Steven Lord
Steven Lord 2022 年 5 月 10 日
I believe if you launch the application from a system command prompt (Command Prompt on Windows, for example) rather than double-clicking the app icon in File Explorer then any error messages that the app generates will show in that prompt.
If you try it and that doesn't, you may want to send the app to Technical Support and work with them to determine what function or functions you're using that are not being packaged into the app.
Alternately for debugging purposes you could wrap those Function* calls in try / catch blocks and show a uialert window with the error information from the catch block. This may indicate the cause of the problem and lead to a workaround or solution. See the code below for an example of what I'm thinking using fprintf (since MATLAB Answers can't display a uialert window.)
x = (1:2)+(1:3);
catch ME
fprintf("Failure! Error message was:\n%s", ME.message)
Failure! Error message was: Arrays have incompatible sizes for this operation.
Or if that's your actual code (with some lines elided) I did note one problem on closer inspection:
[Outputs1] = Function1(Inputs1);
if Outputs
You assign the Outputs1 but then test Outputs (no 1.)
  1 件のコメント
Bowei Li
Bowei Li 2022 年 5 月 10 日
Thanks a lot Steven! I tried what you said (try catch and show the error) and found the reason is that the prograrm is trying to open and write in a file but doesn't have permission to do so.


その他の回答 (0 件)


Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by