Why can't I use the "Load Application" button in my deployed SLRT app to switch between MLDATX files to run on my Speedgoat target?

16 views (last 30 days)
I have an App Designer app to interact with a Simulink Real-Time (SLRT) simulation running on my Speedgoat target. When running the app in MATLAB, I can switch between multiple MLDATX real-time application files to run on my Speedgoat using this dialog:
Then, I deployed this app to a standalone executable using MATLAB Compiler. However, when I try to click the "Load Application" button in the standalone app, either nothing happens (no dialog opens), or the following error occurs when attempting to load the MLDATX file:
Dot indexing into the result of a function call requires parentheses after the function name. The supported syntax is 'sIrealtime().internal'.
Then, I tried to implement a manual logic in my app using app.tg.load() that switches between MLDATX files of the same name located in different folders. This works when launching the app from MATLAB, but not when it's deployed.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Feb 2024
Edited: MathWorks Support Team on 29 Feb 2024
This is a limitation of Simulink Real-Time (SLRT). Standalone SLRT apps deployed with MATLAB Compiler can only be used with a single MLDATX file. 
As a consequence, the dialog to browse for an MLDATX file is disabled when clicking the "Load Application" button in a deployed SLRT app. Instead, the name of the MLDATX file must be specified in the app code before compiling it into a standalone executable.
To achieve this, pass the MLDATX name to the LoadButton object's "Application" property in the app startupFcn(), as suggested below:
function startupFcn(app)
  app.LoadButton.Application = 'slrt_ex_osc';
This way, clicking the "Load Application" button loads the single MLDATX file directly without an additional dialog.
Additional Notes:
1. When compiling the app using Application Compiler, make sure the MLDATX file is in the same folder as the MLAPP file, and specify the MLDATX file under "Files required for your application to run" so that it is included in the package: 
2. For apps created using SLRT App Generator, starting from R2022b, the "Application" property will automatically be specified for the "LoadButton" object.
3. To switch between MLDATX files for fast design iterations, you can use a minimal installation of the two products MATLAB and Simulink Real-Time, as per our Test Operator license model. For more information on this, see:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!