Main Content

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 cell contents from table in Model Advisor analysis results
setColHeadingSpecify column title for table in Model Advisor analysis results
setColHeadingAlignSpecify column title alignment
setColHeadingValignSpecify column title vertical alignment
setColWidthSpecify column widths
setEntriesSpecify contents of table in Model Advisor analysis results
setEntrySpecify content cell in table in Model Advisor analysis results
setEntryAlignSpecify cell alignment for table in Model Advisor analysis results
setEntryValignSpecify table cell vertical alignment
setHeadingSpecify title for table in Model Advisor analysis results
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)

The table "table1" with the text 'Example Text' in Row 3 Column 3

Version History

Introduced in R2006b