view m-toolbox/classes/@ssmblock/getPortsWithName.m @ 33:5e7477b94d94
database-connection-manager
Add known repositories list to LTPDAPreferences
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % GETPORTSWITHNAME get all ports with the matching name.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: GETPORTSWITHNAME get all ports with the matching name.
+ − %
+ − % CALL: ports = getPortsWithName(ssmblocks, name)
+ − % [ports, indices] = getPortsWithName(ssmblocks, plist('name', aName))
+ − %
+ − % VERSION: $Id: getPortsWithName.m,v 1.6 2011/04/08 08:56:31 hewitson Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − function varargout = getPortsWithName(varargin)
+ − error('This function is deprecated and will be deleted')
+ −
+ − [objs, in_vars, rest] = utils.helper.collect_objects(varargin(:), 'ssmblock');
+ − [pl, in_vars, rest] = utils.helper.collect_objects(rest, 'plist');
+ −
+ − ports = [];
+ − indices = {};
+ −
+ −
+ − if isa(pl, 'plist')
+ − name = pl.find('name');
+ − end
+ − for kk=1:numel(rest)
+ − if ischar(rest{kk})
+ − name = rest{kk};
+ − end
+ − end
+ −
+ − for kk=1:numel(objs)
+ − idx = strcmpi(name, {objs(kk).ports.name});
+ − ports = [ports objs(kk).ports(idx)];
+ − indices = [indices {find(idx)}];
+ − end
+ −
+ − if nargout == 1
+ − varargout{1} = ports;
+ − elseif nargout == 2
+ − varargout{1} = ports;
+ − varargout{2} = indices;
+ − end
+ −
+ − end