addRow

Class: ModelAdvisor.FormatTemplate
Package: ModelAdvisor

Add row to table

Syntax

addRow(ft_obj, {item1, item2, ..., itemn})

Description

addRow(ft_obj, {item1, item2, ..., itemn}) is an optional method that adds a row to the end of a table in the result. ft_obj is a handle to the template object previously created. {item1, item2, ..., itemn} is a cell array of strings and objects to add to the table. The order of the items in the array determines which column the item is in. If you do not add data to the table, the Model Advisor does not display the table in the result.

    Note:   Before adding rows to a table, you must specify column titles using the setColTitle method.

Examples

Find all of the blocks in the model and create a table of the blocks:

% Create FormatTemplate object, specify table format
ft = ModelAdvisor.FormatTemplate('TableTemplate');

% Add information to the table
setTableTitle(ft, {'Blocks in Model'});
setColTitles(ft, {'Index', 'Block Name'});
% Find all the blocks in the system and add them to a table.
allBlocks = find_system(system);
for inx = 2 : length(allBlocks)
    % Add information to the table
    addRow(ft, {inx-1,allBlocks(inx)});
end
Was this topic helpful?