Unable to locate and load .mat file after compiled into standalone file in App Designer
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Jesse Chao
il 6 Giu 2023
Commentato: Jesse Chao
il 8 Giu 2023
Hello community and team,
I am new to app design and recently created an app using App Designer.
My app includes two additional files. The first one is a .mat file that contains a simFun (with no parallel turned on) and a doseTable. The second file is a class used to solve my equation.
The app runs flawlessly in the App Designer UI, but when I compile it into a standalone app, it always gets stuck at the simulation part. It seems that the compiled app cannot find and load the .mat file.
I have done some research on the isdeployed function, but none of the solutions I found could solve my problem and how could I locate the .mat file if I don’t know the path of the file in the app?
Interestingly, when I compiled the app on my MacBook Pro 15-inch 2016, it didn't work properly. However, when I used my friend's Mac mini 2021 M1, the compiled app worked without any issues. Both computers have MATLAB 2023a installed.
I have been frustrated as I couldn't solve this problem for a few days.
Could anyone provide me with some suggestions or advice regarding this situation?
Thank you very much.
Jesse
0 Commenti
Risposta accettata
Arthur Goldsipe
il 7 Giu 2023
I suspect the problem is that you need to include in your app additional supporting function files that are required by the SimFunction. You can see what files are needed by checking the DependentFiles property of the SimFunction. We also have an example of how to create a deployed application that uses a SimFunction here.
Here is some additional background: Whenever you create a SimFunction, one or more MATLAB function files are created and stored on the file system. When you first evaluate that SimFunction or call the accelerate method, MEX files are usually created as well. In a normal MATLAB session, these files are automatically created and added to the MATLAB path when you load a SimFunction object from a MAT file. However, in a deployed app, function files are not allowed to be added to the MATLAB path at runtime. So you must include these function files in the app when you create it.
I hope that fixes your problem. If you have any followup questions, let me know.
-Arthur
3 Commenti
Arthur Goldsipe
il 8 Giu 2023
I'm not an expert on creating standalone applications, but let me see if I can help. If I can't answer your question, then it might be worth posting a new question specifically tagged as a question about the MATLAB Compiler.
Anyway, I think you have several options for getting information about the error. The easiest option might be to change the options of your deployed application so that it creates a log file that you can inspect. This page says it's an option under Additional Runtime Settings Options.
I have also lauched applications from the terminal on my Mac or from the Command Window within MATLAB, so that I can see output like error messages. When I create an app on the Mac, it also generates a shell script. For example, if I deploy MyApp.m, I can launch the deployed app MyApp.app by running run_MyApp.sh. Note that it needs one argument, which is the path to the root of your MATLAB or MCR installation. If I recall correctly, you don't get this shell script on Windows, but you can still launch the executable from a Command Window.
Più risposte (0)
Community
Più risposte nel SimBiology Community
Vedere anche
Categorie
Scopri di più su Perform Sensitivity Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!