diff m-toolbox/classes/@ssmblock/getPortsAtIndices.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@ssmblock/getPortsAtIndices.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,36 @@
+% GETPORTSATINDICES get all ports at the given indices.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: GETPORTSATINDICES get all ports at the given indices.
+%
+% CALL:            ports = getPort(ssmblocks, indices)
+%                  ports = getPort(ssmblocks, plist('indices', someIndices))
+%
+% VERSION:     $Id: getPortsAtIndices.m,v 1.5 2011/02/18 16:48:54 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+function varargout = getPortsAtIndices(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')
+    indices = pl.find('indices');
+  end
+  for kk=1:numel(rest)
+    if isnumeric(rest{kk})
+      indices = rest{kk};
+    end
+  end
+  
+  for kk=1:numel(objs)
+    ports   = [ports objs(kk).ports(indices(indices<=numel(objs(kk).ports)))];
+  end
+  
+  varargout{1} = ports;
+  
+end