www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgmodelnode/getoutputs.m

    function list=getoutputs(obj)
%GETOUTPUTS
%
%  LIST =GETOUTPUTS(ND) Returns an N*2 cell array with one row for each
%  quantity which can be calculated for this model.  The first element in
%  each row contains the name of the quantity, and the second, a handle for
%  the function which calculates it.
%
%  The function has prototype:
%     out=func(obj, inputs)
%  where obj is the model node, inputs is the pointer array of gridding
%  variables and the return value is a matrix with dimensions determined by
%  the cgvalue instances which the model takes as inputs.

%  Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc.


list={'Model',@i_CalcModel;
    'Prediction error',@i_CalcPE};


%---------------------------------
function out=i_CalcModel(obj, vars)

if ~isa(obj,'cgmodelnode')
	error(message('mbc:cgmodelnode:InvalidArgument'));
end

model=getdata(obj);

out = model.evaluategrid(vars);
if model.isSwitchExpr && all(isnan(out(:)))
    out = 'Cannot plot a point-by-point model except at operating points';
end


%-------------------------------
function out=i_CalcPE(obj, vars)

if ~isa(obj,'cgmodelnode')
	error(message('mbc:cgmodelnode:InvalidArgument'));
end

model=getdata(obj);
if pevcheck(model.info)
    out = model.evaluategrid(vars, 'pev');
    if model.isSwitchExpr && all(isnan(out(:)))
        out = 'Cannot plot a point-by-point model except at operating points';
    end
else
    out='Prediction error is not defined for this model';
end