主要内容

addColumn

R2026b

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

Add new column to custom table

Description

tableControl.addColumn(Name=Value) adds a column with the specified properties to the 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.

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.

Example: tableControl.addColumn(Name='HDL Name',Type='edit');

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

Name of the column, specified as a character vector or string.

Example: Name="HDL Name"

Data Types: char | string

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

Example: Type="popup"

Data Types: char | string

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

Example: Enabled="on"

Option to control the visibility of the column, specified as "on" or "off"

Example: Visible="on"

The initial width of the column, specified as an integer.

Example: Width=2

Data Types: int

Option to evaluate the MATLAB expression in the column, specified as "on" or "off". Enabling this option stores the evaluated value of the expression in the column. Otherwise, the column stores the literal value.

Example: Evaluate="on"

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

Data Types: cell

Examples

expand all

Create a model and add a subsystem block.

new_system("addColumnExample");
add_block("built-in/subsystem","addColumnExample/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.

tableControl = maskObj.getDialogControl("myTable");

Add two columns named Work and Priority.

tableControl.addColumn(Name="Work",Type="edit",Width=100);
tableControl.addColumn(Name="Priority",Type="popup",TypeOptions={'High','Medium','Low'},...
Enabled="on",Visible="on",Width=100,Evaluate="off");

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

set_param("addColumnExample/subsystem","myTable","{'work A','High'}");
open_system("addColumnExample/subsystem");

Version History

Introduced in R2019a

expand all