ModelAdvisor.Table

Create table for Model Advisor results

Description

ModelAdvisor.Table objects create and format tables in the Model Advisor results. Specify the number of rows and columns in a table, excluding the table title and table heading row.

Creation

Description

example

table = ModelAdvisor.Table(row,column) creates a table object containing the number of rows and columns that you specify.

Input Arguments

expand all

Number of rows to create in the Model Advisor results table

Number of columns to create in the Model Advisor results table

Object Functions

getEntryGet table cell contents
setColHeadingSpecify table column title
setColHeadingAlignSpecify column title alignment
setColHeadingValignSpecify column title vertical alignment
setColWidthSpecify column widths
setEntriesSet contents of table
setEntryAdd cell to table
setEntryAlignSpecify table cell alignment
setEntryValignSpecify table cell vertical alignment
setHeadingSpecify table title
setHeadingAlignSpecify table title alignment
setRowHeadingSpecify table row title
setRowHeadingAlignSpecify table row title alignment
setRowHeadingValignSpecify table row title vertical alignment

Examples

collapse all

Create a table that will appear in the Model Advisor results. This table has five rows and five columns that contain randomly generated numbers.

Use the following MATLAB® code in a callback function. The Model Advisor displays table1 in the results.

matrixData = rand(5,5) * 10^5;

% Initialize a table with 5 rows and 5 columns (heading rows not counting).
table1 = ModelAdvisor.Table(5,5);

% Set column headings
for n=1:5
    table1.setColHeading(n, ['Column ', num2str(n)]);
end

% Center the second column heading
table1.setColHeadingAlign(2, 'center');

% Set column width of the second column
table1.setColWidth(2, 3);
 
% Set the row headings
for n=1:5
    table1.setRowHeading(n, ['Row ', num2str(n)]);
end

% Enter table content
for rowIndex=1:5
    for colIndex=1:5
        table1.setEntry(rowIndex, colIndex, ...
            num2str(matrixData(rowIndex, colIndex)));
        
        % set alignment of entries in second row
        if colIndex == 2
            table1.setEntryAlign(rowIndex, colIndex, 'center');
        end
    end
end

% Overwrite the content of cell 3,3 with a ModelAdvisor.Text  object
text = ModelAdvisor.Text('Example Text'); 
table1.setEntry(3,3, text)

Introduced in R2006b