www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgslparser/findDstBlocks.m
function handle = findDstBlocks(obj,b,outportnum) %FINDDSTBLOCKS Return the destination block for this block % % handle = findDstBlocks(obj,b,outportnum) % Copyright 2007 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin==2 outportnum=1; end porthandles = get_param(b,'porthandles'); outport = porthandles.Outport; line = get_param(outport(outportnum),'line'); if line==-1 handle=get_param(b,'handle'); return else tracedPort = get_param(line,'NonVirtualDstPorts'); BaseSys = get_param(bdroot(b),'name'); handle = zeros(1,length(tracedPort)); for i=1:length(tracedPort) pt = get_param(tracedPort(i),'Parent'); DstParent = get_param(pt,'Parent'); while ~strcmp(DstParent,BaseSys) if iscgSubSystem(obj.SLBlocks , DstParent) pt = DstParent; break else DstParent = get_param(DstParent,'Parent'); end end handle(i) = get_param(pt, 'handle'); end end