Main Content


Represent real-time application and target computer status

Since R2020b


A Target object represents a target computer and provides access to Object Functions, Target Object Properties, and Target Object Events related to the target computer.

The object provides access to methods and properties that:

  • Start and stop the real-time application.

  • Read and set parameters.

  • Monitor signals.

  • Retrieve status information about the target computer.

  • Restart the target computer.

  • Load the real-time application.

  • Start, stop, and retrieve information from the profiler.

Function names are case-sensitive. Type the entire name. Property names are not case-sensitive. You do not need to type the entire name if the characters you type are unique for the property.

You can invoke some of the object properties and functions from the target computer command line when the real-time application has been loaded. For more information, see Target Computer Command-Line Interface.


target_object = slrealtime constructs a target object representing the default target computer.

target_object = slrealtime(target_name) constructs a target object representing the target computer designated by target_name.

The slrealtime function accepts these arguments:

  • target_name — Name assigned to target computer (character vector or string scalar). For example, 'TargetPC1'.

  • target_object — Object representing target computer. For example, tg.

Example: Create Target Object for Default Target Computer

Example: Build and Run Real-Time Application

Object Functions

addInstrumentAdd instrument object to target object
clearStartupAppClear startup application selection on target computer
connectConnect MATLAB to target computer
copyPageCopy one calibration page to another in the real-time application
deleteParamSetDelete selected parameter set file from an application
deleteProfilerDataDelete execution profiler data from target computer
disconnectDisconnect MATLAB from target computer
exportParamSetWrite ParameterSet object data to parameter set file
getAllInstrumentsGet information on instruments added to target object
getApplicationFileGet name of real-time application file
getAvailableProfileGet information about available execution profiler data
getECUPageGet current page number used by ECU on real-time application
getInstalledApplicationsGet list of installed real-time application files
getLastApplicationGet name of real-time application most recently run on target computer
getNumPagesGet number of pages in memory for real-time application
getPersistentVariablesGet persistent variables from the Simulink Real-Time target computer to MATLAB
getProfilerDataRetrieve profile data object
getStartupAppGet information about startup application configuration on target computer
getXCPPageGet current page number used by XCP on real-time application
getparamRead value of observable parameter in real-time application
getsignalRead a signal value from a real-time application
getVersionGet MATLAB, support package, and Speedgoat I/O Blockset version information
importParamSetCreate ParameterSet object
installInstall real-time application on target computer
isConnectedGet target computer connected status
isLoadedGet real-time application loaded status
isRunningGet real-time application running status
listParamSetList available parameter set files for application
loadDeploy to target and load real-time application to target computer
loadParamSetRestore parameter values saved in specified file
rebootRestart target computer
removeAllInstrumentsRemove instrument objects from target object
removeAllApplicationsRemoves all Simulink Real-Time applications from target computer
removeApplicationRemoves Simulink Real-Time application from target computer
removeInstrumentRemove selected instrument object from target object
resetReset target object
resetProfilerReset profiling service state to Ready
saveParamSetSave real-time application parameter values
setECUAndXCPPageSet memory pages used by XCP and ECU to selected memory page on real-time application
setECUPageSet memory page used by ECU to selected memory page on real-time application
setStartupAppConfigure startup real-time application for target computer
setStopTimeConfigure stop time for real-time application
setXCPPageSet memory page used by XCP to selected memory page on real-time application
setipaddrSet IP address and netmask on the target computer
setparamChange value of tunable parameter in real-time application
setPersistentVariablesSet persistent variables from MATLAB to the Simulink Real-Time target computer
startStart execution of real-time application on target computer
startProfilerStart profiling service on target computer
startRecordingStarts signal data live streaming and File Log logging
statusGet status of real-time application on target computer
stopStop execution of real-time application on target computer
stopProfilerStop profiling service on target computer
stopRecordingStops signal data live streaming and File Log logging
updateUpdate RTOS version on target computer


collapse all

Create a target object that represents the default target computer.

Create target object tg for the default target computer. You can select the default target computer by using Simulink Real-Time Explorer.

tg = slrealtime

Create a target object that represents target computer TargetPC1.

Create target object tg for a target computer by using an explicit name.

tg = slrealtime('TargetPC1')

Build and download slrt_ex_osc and execute the real-time application.

Open, build, and download the real-time application:

model = 'slrt_ex_osc';
tg = slrealtime('TargetPC1');

Version History

Introduced in R2020b

expand all