Main Content

Menu

Create menu of commands for instrument panel UI

Since R2021b

Description

example

hMenu = slrealtime.ui.container.Menu(hFigure) adds a menu to an existing menu or to a figure for an instrument panel uifigure figure. The menu commands include:

  • Select a target computer

  • Connect or disconnect a target computer

  • Load a real-time application on a target computer

  • Start or stop a real-time application running on a target computer

  • Update software on a target computer

For information about the slrealtime.ui.container.Menu component TargetSelector property, see slrealtime.ui Properties.

Examples

collapse all

Creates a menu of commands for the instrument panel.

% Create figure 
hFig = uifigure(); 
% Create hMenu 
hUIMenu = uimenu(hFig); 
% Create Menu component 
hSlrtTMenu = slrealtime.ui.container.Menu(hFig); 
hSlrtUIMenu = slrealtime.ui.container.Menu(hUIMenu, 'Name', 'mymenu');

If you select Options > Menu in the Simulink Real-Time App Generator, the generator creates a menu that provides target computer controls. In the startupFcn of the generated instrument panel app, the Code View shows how this menu sets property values for this menu.

menu = slrealtime.ui.container.Menu(app.UIFigure);
targetSelector = menu.TargetSelector;
menu.SkipInstall = 0;
menu.AsyncLoad = 0;
menu.ReloadOnStop = 1;
menu.AutoImportFileLog = 1;
menu.ExportToBaseWorkspace = 1;

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

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Name', 'mymenu'

The Name name-value argument selects a name for the menu that you create.

Example: 'Name', 'mymenu'

Data Types: string

Output Arguments

collapse all

The hMenu argument is the handle to the menu component that you create.

Version History

Introduced in R2021b