Main Content

setEntryAlign

Specify cell alignment for table in Model Advisor analysis results

    Description

    setEntryAlign(tableObj,row,column,alignment) sets the horizontal alignment of the cell in the row, row, and column, column, of Model Advisor table object tableObj to the alignment specified by alignment.

    Note

    The function setEntryAlign 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

    Create a Model Advisor table object, add content to a cell, and set the cell text alignment.

    Use ModelAdvisor.Table to create a Model Advisor table object with two rows and three columns.

    T1 = ModelAdvisor.Table(2,3);
    

    Add a title to the table.

    setHeading(T1,'Title of New Table');

    Add the text 'First Entry' to the cell in the first row and first column of the Model Advisor table object T1.

    setEntry(T1,1,1,'First Entry');
    

    Center the content in the cell in the first row and first column of the Model Advisor table object.

    setEntryAlign(T1,1,1,'center');
    

    Use setEntryAlign in a check callback function in your sl_customization file to format your Model Advisor analysis results.

    function result = SampleStyleOneCallback(system)
    T1 = ModelAdvisor.Table(2,3);
    setHeading(T1,'Title of New Table');
    setEntry(T1,1,1,'First Entry');
    setEntryAlign(T1,1,1,'center');
    result = T1;
    end

    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.

    Row of the table, specified by an integer.

    Column of the table, specified by an integer.

    Horizontal cell alignment, specified as 'left', 'center', or 'right'.

    alignmentDefinition
    'left'Horizontally align contents to the left edge of the cell.
    'center'Horizontally center cell contents.
    'right'Horizontally align contents to the right edge of the cell.