How can I debug my standalone application with MATLAB Compiler?

23 views (last 30 days)

I created an app in App Designer and used MATLAB Compiler to compile it as a standalone application. When I run the standalone application, I encounter crashes or other unexpected behaviors that do not occur when the code is run locally in MATLAB. However, I am unable to see any clear errors or crash logs. 
How can I get more information to debug my compiled application?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Nov 2024 at 0:00
You may be able to reveal additional debugging information by running your standalone application from a terminal or command line. 
MATLAB
If the issue is occurring on the same machine used to compile the app, you can access additional command-line output by running the standalone app through MATLAB.
  1. In MATLAB, navigate to the "for_testing" folder for your app.
  2. Run the app from MATLAB using the bang operator: 
    >> !myStandaloneApp
  3. Reproduce the issue and check the Command Window for errors.
Windows
Note that standalone applications compiled for Windows machines using the Application Compiler, mcc -e, or compiler.build.standaloneWindowsApplication will suppress the command window by default. In order to view debugging output at the command line, you must compile your standalone application with this option disabled:
  • Using the Application Compiler: Uncheck "Do not display the Windows Command Shell (console) for execution" under "Additional runtime settings".
  • Using mcc: Use mcc -m instead.
  • Using compiler.build.standaloneWindowsApplication: Build with compiler.build.standaloneApplication instead.
Then, to run the application:
  1. Open a new Command Prompt.
  2. Navigate to the directory containing your app executable: 
    cd C:\Program Files\myStandaloneApp\application
  3. Run your app from the command prompt: 
    myStandaloneApp.exe
  4. Reproduce the issue and check the command prompt window for errors.
Linux
  1. Open a terminal window.
  2. Navigate to the directory containing your app executable: 
    cd /usr/myStandaloneApp/application
  3. Run your app from the command prompt: 
    ./myStandaloneApp
  4. Reproduce the issue and check the command prompt window for errors.
macOS
  1. Open a Terminal window.
  2. Navigate to the directory containing your app executable: 
    cd /Applications/myStandaloneApp/application
  3. Run your app from the command prompt: 
    ./myStandaloneApp
  4. Reproduce the issue and check the command prompt window for errors.
If you experience issues with the above steps due to issues locating MATLAB Runtime, you can pass the location of MATLAB Runtime as an input to the associated shell script (run_myStandaloneApp.sh) on Linux or macOS to launch the application. For other options, see the following documentation: https://www.mathworks.com/help/compiler/mcr-path-settings-for-run-time-deployment.html 

More Answers (0)

Categories

Find more on Standalone Applications in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!