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

    function optim = removeRuns(optim, RunIdx)
%REMOVERUNS Remove specified runs.
%
%   OPTIM = REMOVERUNS(OPTIM, RUNIDX) removes the specified runs from the
%   optimization.  The resulting number of remaining runs is limited to a
%   minimum of one - if all runs are removed then this will be a "new" run
%   that contains default data settings.

%   Copyright 2005 The MathWorks, Inc.


OldNR = getNumRuns(optim);
NewNR = OldNR-length(RunIdx);
KeepIdx = setdiff(1:OldNR, RunIdx);

optim.NumberOfRuns = max(1,NewNR);

pVar = [getfreevalues(optim), getfixedvalues(optim)];
for n = 1:length(pVar)
    pVar(n).info = pVar(n).removestorevalues(optim.SetupGUID, unique(RunIdx));
    pVar(n).info = pVar(n).remapstorekeys(optim.SetupGUID, KeepIdx, 1:NewNR);
end