www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@model/SummaryStatistics.m

    function S= SummaryStatistics(obj ,Stats)
%SUMMARYSTATISTICS Calculate summary statistics of model fit.
%
%   SS = SUMMARYSTATISTICS(MODEL) returns a structure array containing
%   Statistics and Names fields for the model M.
%
%   SS = SUMMARYSTATISTICS( MODEL, NAMES ) returns an array of the statistics
%   specified by NAMES. NAMES can be a char array, or a cell array of
%   strings.
%
% See also mbcmodel.model.StatisticsDialog,
% mbcmodel.abstractresponse.SummaryStatistics 

%   Copyright 2004-2006 The MathWorks, Inc.

% Can only get stats if fitted already
error( obj.pAssertNotBeingEdited() );
error( obj.pAssertIsFitted() );

mdl= obj.Object;
Names= StatsList(mdl);
[X, Y] = pGetData(obj);

[x,y]= checkdata(mdl,X,Y);
% summary stats
data = FitSummary(mdl,x,y);

if nargin>1
    % select some of the statistics
    [ism,ind]= ismember(Stats,Names);
    if ~all(ism)
        error(message('mbc:mbcmodel:model:InvalidProperty'));
    end
    % only return data
    S= data(:,ind);
else
    % structure
    S.Statistics = data;
    S.Names= Names;
end