Contenido principal

setColWidth

Specify column widths for table

    Description

    setColWidth(tableObj,column,relativeWidth) specifies the width, relativeWidth, for the columns in the Model Advisor table object, tableObj.

    Note

    The function setColWidth is for formatting tables in Model Advisor analysis results with Simulink® Check™. For more information, see Simulink Check.

    For information on how to use tables in MATLAB®, see Create Tables and Assign Data to Them.

    example

    Examples

    collapse all

    This example shows how to create a Model Advisor table object and specify column widths for the table.

    Use ModelAdvisor.Table to create a Model Advisor table object with one row and three columns.

    table1 = ModelAdvisor.Table(1, 3);

    Add entries to the cell and specify column widths for the corresponding cells in the Model Advisor table object.

    setEntry(table,1,1,'entry 1');
    setEntry(table,1,2,'entry 2');
    setEntry(table,1,3,'entry 3');
    
    setColWidth(table,1,1); % set column 1 to the default width
    setColWidth(table,2,2); % make column 2 twice as wide as column 1
    setColWidth(table,3,3); % make column 3 three times as wide as column 1

    For more information on how to format check results, see Define Custom Model Advisor Checks.

    Input Arguments

    collapse all

    Table of Model Advisor results, specified as a ModelAdvisor.Table object.

    Number of columns to create in the Model Advisor results table, specified as an integer.

    Example: 2

    Data Types: int

    Relative width of column, specified as an integer.

    The column width is relative to the width of the entire table. For example, this code makes the second column twice as wide as the first column and the third column three times as wide as the first column:

    setColWidth(table,1,1); % set column 1 to the default
    setColWidth(table,2,2); % make column 2 twice as wide as column 1
    setColWidth(table,3,3); % make column 3 three times as wide as column 1
    By default, the columns in ModelAdvisor.Table have a relativeWidth of 1.

    Example: 3

    Data Types: int

    Version History

    Introduced in R2006b