Main Content

setColTitles

Add column titles to table in Model Advisor analysis results

    Description

    example

    setColTitles(ftObj,colTitles) sets the column titles in the table specified by Model Advisor formatting object ftObj to the title text specified by colTitles. If you do not add data to a table, Model Advisor does not display the table in the results.

    Note

    Before adding data to a table, you must specify column titles using the setColTitles method.

    The function setColTitles 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.

    Examples

    collapse all

    Create a Model Advisor format template object, ft, of type 'TableTemplate', and specify two column titles.

    Use ModelAdvisor.FormatTemplate to create a Model Advisor formatting template ft of type 'TableTemplate'.

    ft = ModelAdvisor.FormatTemplate('TableTemplate');

    Specify the column titles for the table template object. Specify 'Index' as the title for the first column and 'Block Name' for the second column.

    setColTitles(ft,{'Index','Block Name'});
    

    Use setColTitles in a check callback function in your sl_customization file.

    function result = SampleStyleOneCallback(system)
    ft = ModelAdvisor.FormatTemplate('TableTemplate');
    setTableTitle(ft,{'Blocks in Model'});
    setColTitles(ft,{'Index','Block Name'});
    setTableInfo(ft,{'1', 'Gain'})
    result = ft;
    end

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

    Input Arguments

    collapse all

    ModelAdvisor.FormatTemplate object, specified as a handle to the template object.

    Table column title text, specified as a cell array of character vectors or a handle to a valid formatting object.

    Valid formatting objects:

    The order of the items in the cell array determines which column the item is in.

    Example: {'Index','Block Name'}