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

    function output = getOutput(obj, Runs, Sols)
%GETOUTPUT Return the diagnostic structure of information.
%
%  OUTPUT = GETOUTPUT(OBJ) returns the diagnostic information for all of
%  the optimization runs and solutions. 
%
%  OUTPUT = GETOUTPUT(OBJ, RUNIDX, SOLIDX) returns the diagnostic
%  information for the specified optimization runs and solutions. 

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


if isempty(obj.runStats)
    output = struct([]);
    return
end

nR = getNumRuns(obj);
nS = getNumSolutions(obj);
if nargin ==1
    Runs = 1:nR;
    Sols = 1:nS;
elseif any(Runs <= 0) || any(Runs > nR) || any(Sols<= 0) || any(Sols > nS)
    error(message('mbc:cgoptimoutput:InvalidIndex'));
end

output = obj.runStats;
if isempty(output)
    output = repmat(struct, length(Runs), length(Sols));
elseif size(output,2)==1 && nS>1
    % Expand the flag-per-run to provide one per solution
    output = repmat(output(Runs), 1, length(Sols));
else
    output = output(Runs, Sols);
end