Mercurial > hg > ltpda
comparison m-toolbox/classes/@ssmport/char.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 % CHAR convert a ssmport object into a string. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: CHAR convert a ssmport object into a string. | |
5 % | |
6 % CALL: string = char(ssmport) | |
7 % | |
8 % VERSION: $Id: char.m,v 1.4 2011/02/18 16:48:55 ingo Exp $ | |
9 % | |
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | |
12 function varargout = char(varargin) | |
13 objs = varargin{1}; | |
14 | |
15 % see if parent block name is there | |
16 if nargin==2 | |
17 parentName=varargin{2}; | |
18 else | |
19 parentName = ''; | |
20 end | |
21 | |
22 pstr = ''; | |
23 for ii = 1:numel(objs) | |
24 [blockName, portName] = ssmblock.splitName(objs(ii).name); | |
25 if strcmpi(parentName, blockName) | |
26 pstr = [pstr portName ' ' char(objs(ii).units) ', ']; | |
27 else | |
28 pstr = [pstr objs(ii).name ' ' char(objs(ii).units) ', ']; | |
29 end | |
30 end | |
31 | |
32 % remove last ', ' | |
33 if length(pstr)>1 | |
34 pstr = pstr(1:end-2); | |
35 end | |
36 | |
37 %%% Prepare output | |
38 varargout{1} = pstr; | |
39 end |