Clear Filters
Clear Filters

slrealtime.Application fails with "Enter a valid application name"

12 views (last 30 days)
Hi,
When I try to run slrealtime.Application('<appname>'), where <appname> is my application name without the .mldatx extension, I get an error message saying I need to enter a valid application name. I've tried passing the application name with and without the path, but it fails either way. Any idea what I might be doing wrong? Here is the error message below:
>> tg.getInstalledApplications
ans =
1×1 cell array
{'<appname>'}
>> slrealtime.Application('<appname>')
Error using slrealtime.internal.Application
Enter a valid application name
Error in slrealtime.Application

Answers (1)

Varun
Varun on 30 Oct 2023
Hi Jeffrey,
Looks like you are trying to run "slrealtime.Application('<appname>')" where <appname> is the application name without ".mldatx" extension but you are facing an error message as "Enter a valid application name".
The functions "tg.getInstalledApplications" and "slrealtime.Application('<appname>')" which you have used appears to be correct. However, you can follow some workarounds to troubleshoot the issue:
  1. Ensure that you created the "slrealtime.Application('<appname>')" object only after the real-time application has been built. The argument is the file name without the ".mldatx" file extension of the MLDATX file that the build produces on the development computer.
  2. Ensure that you have specified the correct application name without any typos or case sensitivity issues.
  3. Make sure that your MATLAB working directory is set to the folder where your Simulink Real-Time application resides. The application name should be specified relative to this directory. If you are not in the correct directory, MATLAB might not be able to find the application.
  4. Verify that the application files are present in the specified directory. The application name you provide should correspond to the .mldatx file that represents your Simulink Real-Time application.
Please refer to the following documentation to learn more about using "slrealtime.Application()" function:
  1 Comment
Jeffrey
Jeffrey on 31 Oct 2023
It seems simulink doesn't know the path, so I had to go through a convoluted set of commands to get it to work:
myAppName = tg.ModelStatus.Application;
myFileName = tg.getApplicationFile(myAppName);
myApp = slrealtime.Application(myFileName);

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!