www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgprojconnections/getAllDpts.m
function AllDpts= getAllDpts(A,items,C,MajorItems) %GETALLDPTS list all items in project which are used by an item % % AllDpts= getAllDpts(A,items % AllDpts= getAllDpts(A,items,C) % AllDpts= getAllDpts(A,items,C,MajorItems) % % Inputs % A cgprojconnections object % items item or items to find dependents for % C logical array for items % MajorItems logical restricting outputs to major items (default true) % Copyright 2004-2008 The MathWorks, Inc. if nargin<3 || isempty(C) C= false(size(A.Names)); end C= iAllDpts( A.Connections,C,items); if nargin<4 || MajorItems AllDpts= find(C & A.IsMajorItem); else AllDpts= find(C); end function C= iAllDpts(M,C,items) for i=1:length(items) f= M(items(i),:); for j= find(f) if ~C(j) C(j)= true; C= iAllDpts(M,C,j); end end end