Unable to locate and load .mat file after compiled into standalone file in App Designer
조회 수: 21 (최근 30일)
이전 댓글 표시
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
채택된 답변
Arthur Goldsipe
2023년 6월 7일
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
Arthur Goldsipe
2023년 6월 8일
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.
추가 답변 (0개)
커뮤니티
더 많은 답변 보기: SimBiology Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Perform Sensitivity Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!