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

    function exitFlag = getExitFlag(obj, Runs, Sols)
%GETEXITFLAG Return the exit flag.
%
%  EXITFLAG = GETEXITFLAG(OBJ) returns the exit status of the all the
%  optimization runs and solutions.  EXITFLAG is a matrix of size
%  (NRUNS-by-NSOLS).
%
%  EXITFLAG = GETEXITFLAG(OBJ, RUNIDX, SOLIDX) returns the exit status of
%  the specified optimization runs and solutions. If any element of SOLIDX
%  is set to -1, the selected solution is used for each specified RUNIDX.

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


if nargin==1
    Runs = ':';
    Sols = ':';
end

AllExitFlag = obj.runFlags;
nS = getNumSolutions(obj);
if size(AllExitFlag,2)==1 && nS>1
    % Expand the flag-per-run to provide one per solution
    AllExitFlag = repmat(AllExitFlag, 1, nS);
end
exitFlag = pGetFlagData(obj, AllExitFlag, Runs, Sols);