Main Content


Class: Simulink.dialog.ListboxControl
Namespace: Simulink.dialog

Set values for a list box


setItems = listboxControl.setSelectedItems({string1','string2',...})


setItems = listboxControl.setSelectedItems({string1','string2',...}) sets the values for the selected items in the list box.

Input Arguments

expand all

Handle to the list box, specified as an object. You can use the getDialogControl command to get the list box handle. For more information, see Simulink.dialog.Container.getDialogControl.

For example, litboxControl = maskObj.getDialogControl('listboxname'). Here, maskObj is the mask object and listboxname is the name of the list box.

Data Types: cell array

Value to be set for selected items in the list box

For example, 'Hello'.


% Get block mask handle
maskObj = Simulink.Mask.get(gcb); 

% Get listbox handle
listboxControl = maskObj.getDialogControl('Control2');

% Set selected items

Version History

Introduced in R2019a