Main Content


Represent application files on development computer


An application object represents application files on the development computer. You can create application objects for real-time applications that you build from models.

An application object provides access to methods and properties that let you work with the application blocks and signals.


app_object = slrealtime.Application(application_name) creates an object that you can use to manipulate real-time application files on the development computer. You can create the object only after the real-time application has been built.

The slrealtime.Application function accepts these arguments:

  • application_name — Name of real-time application (character vector or string scalar). For example, 'slrt_ex_osc_inport'.

    This argument is the file name without the .mldatx file extension of the MLDATX file that the build produces on the development computer.

  • app_object — Represent real-time application files on the development computer.

    This argument provides access to methods that manipulate the real-time application files.

Create an application object for real-time application slrt_ex_osc_inport.

app_object = slrealtime.Application('slrt_ex_osc_inport');

Example: Extract ASAP2 File

Example: Update Root-Level Inport Data

Example: Get and Set Application Options

Example: Get Application Signals and Parameters


expand all

This property is read-only.

Name of real-time application created when you built the application.

This property is read-only.

Name of the Simulink model from which you build the real-time application.

You can assign arbitrary vector data to the UserData field. You can access this data from only the development computer.

Example: {'This string', 10}

This property is read-only.

Use the Options property to get and set real-time application options. For an example, see Get and Set Application Options. The options are:

  • fileLogMaxRuns selects the number of simulation runs that are stored for the real-time application when file logging is enabled.

  • loglevel selects the log message level for the target computer system log. The available levels are error, warning, info, debug, and trace.

  • pollingThreshold selects the sample rate below which the RTOS thread scheduler switches polling mode, instead of interrupt-driven mode, for clocking the real-time application. Polling mode can be useful for reducing sample time jitter. But, enabling this option causes the real-time application to consume a CPU core completely to clock and execute the base rate.

  • stoptime selects the stop time for the real-time application.

Object Functions

addParamSetAdd a parameter set to a real-time application
extractASAP2Extract generated A2L file from real-time application file
getAllFileLogBlocksReturns block paths corresponding to File Log blocks in application
getFileLogDecimationReturns decimation value of File Log block based on block path
getInformationGet real-time application information
getParametersGet real-time application parameters
getRootLevelInportsReturns root level inports in application
getSignalsGet real-time application signals
setFileLogDecimationSets decimation value on File Log blocks based on block path and input decimation value
updateRootLevelInportDataReplace external input data in real-time application with input data
updateStartupParameterSetUpdate the startup parameter set for an application


collapse all

Retrieve the ASAP2 file from real-time application.

Create an application object for the real-time application.

app_obj =  slrealtime.Application("myModel.mldatx");

Retrieve the ASAP2 file from the real-time application.


Change waveform data from square wave to sine wave.

Change inport waveform data from a square wave to sine wave.

waveform = sinewave;

Create an application object.

app_object = slrealtime.Application('slrt_ex_osc_inport');

Update the inport data.


Download the updated inport data to the default target computer.

tg = slrealtime('TargetPC1');
load(tg, 'slrt_ex_osc_inport');

You can get and set real-time application options by using the application Options property.

Create an application object.

my_app = slrealtime.Application('slrt_ex_osc_inport');

View application options by getting the application Options property values.

ans = 

  struct with fields:

      fileLogMaxRuns: 1
            loglevel: "info"
    pollingThreshold: 1.0000e-04
            stoptime: Inf

Change the application stop time value option.


Save application options to a MATLAB variable. Apply options from the variable to the real-time application by using the load function.

my_options = my_app.Options.get;
save("my_options.mat", "my_options");
load("my_options.mat", "my_options");

You can get real-time application signals and parameters by using the getParameters and getSignals functions.

Create an application object.

my_app = slrealtime.Application('slrt_ex_param_tuning')
my_app = 

  Application with properties:

    ApplicationName: 'slrt_ex_param_tuning'
          ModelName: 'slrt_ex_param_tuning'
           UserData: []
            Options: [1×1 slrealtime.internal.ApplicationOptions]

Get the application Signals values as structures in an array.

my_sigs = getSignals(my_app)
my_sigs = 

  1×9 struct array with fields:


View application signals as array elements.

ans =


Get the application Parameters values as structures in an array.

my_params = getParameters(my_app)
my_params = 

  1×7 struct array with fields:


View application parameters as array elements.

ans =


Version History

Introduced in R2020b