- MATLAB Compiler Support for MATLAB, Simulink, and Toolboxes
- Functions Not Supported for Compilation by MATLAB Compiler
Best practices & tips for creating standalone SLRT apps for interaction with Speedgoat using App Designer & MATLAB Compiler
22 views (last 30 days)
Show older comments
MathWorks Support Team
on 25 Oct 2023
Edited: MathWorks Support Team
on 17 Jul 2024
What are some best practices & tips for creating standalone Simulink Real-Time (SLRT) apps to control real-time application running on Speedgoat hardware with MATLAB Compiler & App Designer?
Accepted Answer
MathWorks Support Team
on 17 Jul 2024
Edited: MathWorks Support Team
on 17 Jul 2024
To get started, here are some general tips for creating a Simulink Real-Time (SLRT) app:
However, there are some things that work within MATLAB, but not in standalone apps deployed with MATLAB Compiler that you need to keep in mind. Here are general lists of unsupported toolboxes, GUIs, tools, and functions with MATLAB Compiler:
Below is a collection of tips that are particularly relevant when creating standalone SLRT apps:
1. Simulation Data Inspector (SDI) is not deployable: One important limitation of MATLAB Compiler is that Simulation Data Inspector (SDI) cannot be used in standalone apps. Use the "connectLine" functionality instead to stream signals from Speedgoat hardware to axes in your app: https://www.mathworks.com/help/slrealtime/api/slrealtime.instrument.connectline.html
2. Data Dictionaries are not deployable: Data Dictionaries (*.sldd) are not supported for deployment with MATLAB Compiler either. This can cause an issue if, for example, your app needs to access enum definitions from a data dictionary, as this will not work in the standalone application. Define the enums in an M-file instead.
3. Load Application button limitation: In a deployed SLRT app, the dialog to browse for an MLDATX file is not supported when clicking the "Load Application" button. Instead, the name of the MLDATX file must be specified in the app code prior to compiling it into a standalone executable. For details, see: https://www.mathworks.com/matlabcentral/answers/2036376-why-is-the-load-application-button-in-my-standalone-slrt-app-not-working
4. Make sure to set the 'TargetSource' property for your SLRT UI components: If there is a TargetSelector UI component in your app, make sure that every SLRT UI component is pointing to that TargetSelector by using the 'TargetSource' property. For more information, see slrealtime.ui Properties.
5. Target Selector drop-down & target IP address: Note that the TargetSelector drop-down will not work in a standalone app. In R2022b and later, the TargetSelector turns into an edit field so the app user can enter a target IP address. Alternatively, the target IP address must be specified in the app code using the "slrealtime" target object. For details, see: https://www.mathworks.com/matlabcentral/answers/1805745-why-do-i-get-an-target-ip-address-is-empty-error-when-i-try-connect-to-speedgoat-hardware-from-a-d
6. Tips for using the Application Compiler with SLRT: After opening the Application Compiler for the first time and selecting the *.mlapp file, wait for 30-60 seconds until the Application Compiler has finished the dependency analysis and determined that the app requires the SLRT Target Support Package. For details, see: https://www.mathworks.com/matlabcentral/answers/2014801-why-do-i-encounter-the-error-function-requires-simulink-real-time-target-support-package-when-i-ru
Then, make sure to add the MLDATX application file under the "Files required for your application to run" section since it must be packaged into the application.
7. Ensure the end user has the correct MATLAB Runtime version & update installed: To run an SLRT app on a host computer without a MATLAB installation, it is necessary to install MATLAB Runtime. For an SLRT app, it is recommended that the MATLAB Runtime release version and update version should match the version of MATLAB that was used to create the standalone application. The easiest way to ensure a matching MATLAB Runtime is to package the runtime installer into the standalone application; however, increasing IT restrictions might make this workflow difficult for both the developer of the SLRT app, and the end user of the app. If you distribute your standalone SLRT app without the runtime installer packaged in it, it is best to provide a direct link to the matching runtime installer:
https://ssd.mathworks.com/supportfiles/downloads/R20XXx/Release/Y/deployment_files/installer/complete/win64/MATLAB_Runtime_R20XXx_Update_Y_win64.zip
Where "R20XXx" is the number of the major release version (e.g. "R2022b") and "Y" is the update version, as per the "version" MATLAB command.
8. Allow the standalone SLRT app through the firewall: If the host computer where the SLRT app is run has a firewall or antivirus software in place, it may be necessary to allow the app (*.exe) through the firewall to ensure smooth communication between the host and Speedgoat target. Refer to the following page for instructions regarding Windows Firewall: https://www.mathworks.com/matlabcentral/answers/396086-how-do-i-configure-windows-defender-firewall-for-matlab-to-communicate-with-external-hardware-such-a
0 Comments
More Answers (0)
See Also
Categories
Find more on Application Deployment 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!