comparison m-toolbox/classes/@ssmblock/getPortsWithName.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % GETPORTSWITHNAME get all ports with the matching name.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: GETPORTSWITHNAME get all ports with the matching name.
5 %
6 % CALL: ports = getPortsWithName(ssmblocks, name)
7 % [ports, indices] = getPortsWithName(ssmblocks, plist('name', aName))
8 %
9 % VERSION: $Id: getPortsWithName.m,v 1.6 2011/04/08 08:56:31 hewitson Exp $
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 function varargout = getPortsWithName(varargin)
13 error('This function is deprecated and will be deleted')
14
15 [objs, in_vars, rest] = utils.helper.collect_objects(varargin(:), 'ssmblock');
16 [pl, in_vars, rest] = utils.helper.collect_objects(rest, 'plist');
17
18 ports = [];
19 indices = {};
20
21
22 if isa(pl, 'plist')
23 name = pl.find('name');
24 end
25 for kk=1:numel(rest)
26 if ischar(rest{kk})
27 name = rest{kk};
28 end
29 end
30
31 for kk=1:numel(objs)
32 idx = strcmpi(name, {objs(kk).ports.name});
33 ports = [ports objs(kk).ports(idx)];
34 indices = [indices {find(idx)}];
35 end
36
37 if nargout == 1
38 varargout{1} = ports;
39 elseif nargout == 2
40 varargout{1} = ports;
41 varargout{2} = indices;
42 end
43
44 end