Main Content

SLDRT.run

Run model in real time by using Simulink Desktop Real-Time kernel

Since R2023b

Description

statusObject = SLDRT.run(modelName) runs a Simulink® model in real time by using the Simulink Desktop Real-Time™ kernel.

example

statusObject = SLDRT.run(modelName,Name=Value) runs a Simulink model in real time by using the Simulink Desktop Real-Time kernel using one or more name-value pair arguments.

example

Examples

collapse all

This example runs the sldrtex_counter model in the real-time kernel. The command creates a SLDRT.RunStatus object that provides information about the model run.

openExample('sldrtex_counter');
myRunStatus = SLDRT.run('sldrtex_counter',Verbose="off");

Input Arguments

collapse all

Name of the model for the simulation, specified as a character vector or string scalar.

Example: 'sldrtex_counter'

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: Wait="off"

Option to cause MATLAB to wait for the simulation run to stop, specified as "on" or "off".

Example: Wait="off"

Option to override the real-time run mode selected in the model. The available choices are "kernel" or "external" for kernel mode, and "connectedio" or "normal" for connected IO mode. When the SimulationMode value is empty (''), the simulation uses the mode selected by the model. For more information on simulation modes, see Simulate Model in Connected IO Mode and Real-Time Execution in Run in Kernel Mode.

Example: SimulationMode="kernel"

Option to override the model stop time. When the StopTime value is empty (''), the simulation uses the stop time selected by the model.

Example: StopTime="inf"

Option to specify whether to capture data from all scopes.

Example: CaptureAllScopes="off"

Option to specify whether the function opens the model in the Simulink editor (if value is "off") or only loads the model (if value is "on") for simulation.

Example: LoadOnly="off"

Option to enable verbose output mode (if value is "on").

Example: Verbose="off"

Output Arguments

collapse all

Object that provides simulation run status and provides access to data from scopes and logged signals after the simulation run completes. Returned as a SLDRT.RunStatus object.

Version History

Introduced in R2023b