www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgcontainer/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.



% Default for cgcontainers to execute eq on the contained data

nd=address(nd);
ch=nd.children;
if strcmp(class(data),class(nd.getdata)) && data==nd.getdata;
   p=nd;
else
   p=[];
end
for n=1:length(ch)
   p=[p ch(n).recursivesearch(data)];   
end