www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtools/@SummaryStatsTable/updateTable.m

    function updateTable( obj, md )
%UPDATETABLE Set the modeldev that the table is using.
%
%   UPDATETABLE(OBJ, MD)

%   Copyright 2006 The MathWorks, Inc.

if isempty( md )
    obj.Peer.clearTable();
elseif ~isa( md, 'modeldev' )
    error(message('mbc:SummaryStatsTable:InvalidArguments'));
else
    [stats,names] = FitSummary( md );
    obj.Peer.setRowData( names );
    
    % does this happen?
    if length(names)< length(stats)
        stats = stats(1:length(names));
    elseif length(names)> length(stats)
        stats = [stats NaN( 1, length(names)-length(stats) )];
    end
    % we'll set any NaN cells to invisible as well
    obj.Peer.setCellVisible( ~isnan( stats(:) ) );
    obj.Peer.setTableData( stats(:) );
end