Mercurial > hg > ltpda
comparison m-toolbox/classes/@plist/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 parameter list into a string. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: CHAR convert a parameter list into a string. | |
5 % | |
6 % CALL: string = char(plist); | |
7 % | |
8 % <a href="matlab:utils.helper.displayMethodInfo('plist', 'char')">Parameters Description</a> | |
9 % | |
10 % VERSION: $Id: char.m,v 1.28 2011/04/08 08:56:21 hewitson Exp $ | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function varargout = char(varargin) | |
15 | |
16 %%% Check if this is a call for parameters | |
17 if utils.helper.isinfocall(varargin{:}) | |
18 varargout{1} = getInfo(varargin{3}); | |
19 return | |
20 end | |
21 | |
22 objs = utils.helper.collect_objects(varargin(:), 'plist'); | |
23 | |
24 pstr = ''; | |
25 for ii = 1:numel(objs) | |
26 pl = objs(ii); | |
27 if ~isempty(pl.params) | |
28 pstr = [pstr '(' char(pl.params) '), ']; | |
29 else | |
30 pstr = [pstr '(empty-plist), ']; | |
31 end | |
32 end | |
33 | |
34 if length(pstr)>1 | |
35 pstr = pstr(1:end-2); | |
36 else | |
37 pstr = '(empty-plist)'; | |
38 end | |
39 | |
40 %%% Prepare output | |
41 varargout{1} = pstr; | |
42 end | |
43 | |
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
45 % Local Functions % | |
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
47 | |
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
49 % | |
50 % FUNCTION: getInfo | |
51 % | |
52 % DESCRIPTION: Get Info Object | |
53 % | |
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
55 | |
56 function ii = getInfo(varargin) | |
57 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
58 sets = {}; | |
59 pl = []; | |
60 else | |
61 sets = {'Default'}; | |
62 pl = getDefaultPlist; | |
63 end | |
64 % Build info object | |
65 ii = minfo(mfilename, 'plist', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.28 2011/04/08 08:56:21 hewitson Exp $', sets, pl); | |
66 ii.setModifier(false); | |
67 ii.setArgsmin(1); | |
68 ii.setOutmin(0); | |
69 end | |
70 | |
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
72 % | |
73 % FUNCTION: getDefaultPlist | |
74 % | |
75 % DESCRIPTION: Get Default Plist | |
76 % | |
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
78 | |
79 function plo = getDefaultPlist() | |
80 plo = plist(); | |
81 end | |
82 |