www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgmodelnode/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); M=nd.getdata; ptrs = M.getptrs; if data==M || any(ptrs==data) p=nd; else p=[]; end ch=nd.children; for n=1:length(ch) p=[p ch(n).recursivesearch(data)]; end