comparison m-toolbox/classes/@ssmblock/addPorts.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 % ADDPORTS adds the given ssm ports to the list of ports.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: ADDPORTS adds the given ssm ports to the list of ports.
5 %
6 % The given ports are added to the list of ports. No check is done to ensure
7 % the ports remain unique. Instead you should check with
8 % ssmblock.containsPort before adding the ports.
9 %
10 % CALL: block = addPorts(ssmblocks, ports)
11 %
12 % VERSION: $Id: addPorts.m,v 1.4 2011/04/08 08:56:31 hewitson Exp $
13 %
14 %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16 function varargout = addPorts(varargin)
17 warning('This function is outdated and will be deleted')
18 [blocks, invars, rest] = utils.helper.collect_objects(varargin(:), 'ssmblock');
19 ports = utils.helper.collect_objects(rest, 'ssmport');
20
21 % copy or modify
22 outblocks = copy(blocks, nargout);
23
24 % loop over blocks
25 for kk=1:numel(blocks)
26 block = blocks(kk);
27 block.ports = [block.ports copy(ports,1)];
28 end
29
30 if nargout > 0
31 varargout{1} = outblocks;
32 end
33 end