www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgoptimnode/recursivesearch.m
function p=recursivesearch(nd,data) %RECURSIVESEARCH Search tree for nodes related to data % % p=RECURSIVESEARCH(ND, DATA) searches down the tree from ND and returns a % list of node pointers that are related to DATA. % Copyright 2000-2014 The MathWorks, Inc. and Ford Global Technologies, Inc. nd = address(nd); ch = nd.children; pOptim = nd.getdata; % Get the various operating point sets deps = []; deps = [deps, pOptim.getOppointPtr]; % Extract the data items from optim items items = [pOptim.getObjectiveFunc, pOptim.getConstraint]; for n = 1:length(items) deps = [deps, getptrs(items{n})]; end if (data==pOptim) || any(deps==data) p=nd; else p=[]; end for n = 1:length(ch) p = [p ch(n).recursivesearch(data)]; end