Main Content


Create target computer selector component for instrument panel UI

Since R2021b



hTargetSelector = slrealtime.ui.control.TargetSelector(hFigure) creates a target computer selector component for an instrument panel uifigure figure. Simulink® Real-Time™ refers to target computers by mapping unique names to IP addresses. Multiple mappings are allowed.

You can access each target computer by using its name. One mapping is the default and is used when no target computer name is supplied. The target selector component displays the list of all named target computers currently defined on the development computer.

The target computer selector list entry Simulink Normal Mode is not a customer-defined target. This selection appears at the end of the list to support Simulink normal mode simulation of a model. When you select Simulink Normal Mode in the target selector, the load application button changes to a load model button. Use this button to select the model to interface with the control panel app.

The drop-down list is editable. You can enter a valid IP address and create a temporary target computer mapping that is removed when the target computer selector component is destroyed.

It is possible to have different components in the same instrument panel synchronize with different target computers. By selecting a target computer for a component by using the TargetSelector, instrument panel components with their TargetSource property set to the TargetSelector synchronize and are updated to the current state of the target computer selected by the TargetSelector. For more information, see the TargetSource property description in slrealtime.ui Properties.


The TargetSelector operates differently when used in a compiled (standalone) instrument panel app. Instead of selecting the target computer by name from the drop-down list, you connect to the target computer by inserting the target computer IP address (for example, For standalone apps (which operate outside of Simulink), the Simulink Normal Mode option for simulation is not available. For more information, see Create Standalone Instrument Panel App by Using Application Compiler.


collapse all

Create a target selector component and adjust the position of the component.

% Create figure 
hFig = uifigure();
% Create target selector component  
hTgSelect = slrealtime.ui.control.TargetSelector(hFig);
% Change position of the component 
hTgSelect.Position = [100 100 200 30];

Input Arguments

collapse all

The hFigure argument identifies the uifigure to which you are adding the UI component.

Example: hFig = uifigure()

Data Types: function_handle

Output Arguments

collapse all

The hTargetSelector argument is the handle to the target selector component that you create.

Version History

Introduced in R2021b

expand all