www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgproject/findItem.m
function pList = findItem(CGP,varargin) %findItem find item(s) in project % % pList = findItem(CGP,varargin) % pList = findItem(CGP,varargin,Type) % varargin is a property/value pair list of search items for % cgprojconnections/find. Valid properties are 'data', 'node', 'pointer', % 'name', type' % % Type is 'data', 'node', 'pointer', or 'indices'. The pointer type is % the data pointer unless data is null in which case the node pointer is % returned (this is the case for tradeoff nodes). By default, the data % pointer is returned. % % See also cgprojconnections/find % Copyright 2009 The MathWorks, Inc. A = getConnections(CGP); if mod(length(varargin),2)==1 Type = varargin{end}; varargin(end)=[]; else Type = 'data'; end Indices = find(A,varargin{:}); switch lower(Type) case 'data' pList = A.pData(Indices); case 'node' pList = A.pNode(Indices); case 'pointer' pList= majorptrs(A,Indices); case 'indices' pNode= A.pNode(Indices); pList= A.pData(Indices); pList(isnull(pList)) = pNode(isnull(pList)); end