www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimstore/setOutput.m

    function optimstore = setOutput(optimstore, OUTPUT)
%SETOUTPUT Set diagnostic information for the optimization.
%   OPTIMSTORE = SETOUTPUT(OPTIMSTORE, OUTPUT) sets diagnostic information
%   for the optimization in OPTIMSTORE. Any diagnostic information is
%   passed to OPTIMSTORE through the structure, OUTPUT. See the worked
%   example for an example of creating an OUTPUT structure.
%
%   See also MBCOSWORKEDEXAMPLE.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


if isempty(OUTPUT)
    optimstore.ResultStats = OUTPUT;
    return
end
   
if isstruct(OUTPUT) 
    runVer = getRunAPIVersion(optimstore.OptimRunner);
    NRUNS = length(getRunIndices(optimstore.OptimRunner));
    if isscalar(OUTPUT) || ...
       (runVer == 2 && length(OUTPUT) == NRUNS)
        optimstore.ResultStats = OUTPUT;
    else
        error(message('mbc:cgoptimstore:InvalidArgument16'));
    end
else
    error(message('mbc:cgoptimstore:InvalidArgument17'));
end