Hauptinhalt

insertColumn

R2026b

Class: Simulink.dialog.parameter.CustomTable
Namespace: Simulink.dialog.parameter

Insert column at specified index in custom table

Description

tableControl.insertColumn(columnIndex[Name,Value]) inserts a column with the given properties at a specified index in a custom table.

example

Input Arguments

expand all

Custom table handle, specified as a Simulink.dialog.parameter.CustomTable object. You can use the getDialogControl command to get the custom table handle.

Consider, for example, tableControl = maskObj.getDialogControl(TableName). Here, maskObj is the mask object and TableName is the name of the custom table. For more information, see getDialogControl.

Data Types: char vector | cell

Name-Value Arguments

expand all

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.

The type of controls for column, specified as edit or checkbox or popup or combobox.

Data Types: char | string

Options that are displayed within a popup or combobox, specified as a cell array.

Data Types: cell

Option to enable or disable column editability, specified as "on" or "off".

Examples

expand all

Create a model and add a subsystem block.

new_system("insertColumnExample");
add_block("built-in/subsystem","insertColumnExample/subsystem");

Create a mask object for the subsystem and add a custom table parameter named myTable.

maskObj = Simulink.Mask.create(gcb);
maskObj.addParameter(Type="customtable",Name="myTable");

Get the custom table handle. Add a column named Task Name of type Edit.

tableControl = maskObj.getDialogControl("myTable");
tableControl.addColumn(Name="Task Name",Type="edit");

Insert a column named Status of type popup at position 2.

tableControl.insertColumn(2,Name="Status",Type="popup",TypeOptions={'To Do','In Progress','Done'},Enabled="on");

Set the table data and open the subsystem to view the updated table in the mask dialog box.

set_param("insertColumnExample/subsystem","myTable","{'work A','To Do'}");
open_system("insertColumnExample/subsystem");

Version History

Introduced in R2019a

expand all