Mercurial > hg > ltpda
comparison m-toolbox/classes/@rational/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 rational object into a string. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: CHAR convert a rational object into a string. | |
5 % | |
6 % CALL: string = char(rat) | |
7 % | |
8 % <a href="matlab:utils.helper.displayMethodInfo('rational', 'char')">Parameters Description</a> | |
9 % | |
10 % VERSION: $Id: char.m,v 1.9 2011/04/08 08:56:33 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(:), 'rational'); | |
23 | |
24 pstr = ''; | |
25 | |
26 for ii = 1:numel(objs) | |
27 pstr = [pstr 'rational(' objs(ii).name '), ']; | |
28 end | |
29 | |
30 varargout{1} = pstr(1:end-2); | |
31 end | |
32 | |
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
34 % Local Functions % | |
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
36 | |
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
38 % | |
39 % FUNCTION: getInfo | |
40 % | |
41 % DESCRIPTION: Get Info Object | |
42 % | |
43 % HISTORY: 11-07-07 M Hewitson | |
44 % Creation. | |
45 % | |
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
47 | |
48 function ii = getInfo(varargin) | |
49 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
50 sets = {}; | |
51 pl = []; | |
52 else | |
53 sets = {'Default'}; | |
54 pl = getDefaultPlist; | |
55 end | |
56 % Build info object | |
57 ii = minfo(mfilename, 'rational', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.9 2011/04/08 08:56:33 hewitson Exp $', sets, pl); | |
58 ii.setModifier(false); | |
59 end | |
60 | |
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
62 % | |
63 % FUNCTION: getDefaultPlist | |
64 % | |
65 % DESCRIPTION: Get Default Plist | |
66 % | |
67 % HISTORY: 11-07-07 M Hewitson | |
68 % Creation. | |
69 % | |
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
71 | |
72 function plout = getDefaultPlist() | |
73 persistent pl; | |
74 if exist('pl', 'var')==0 || isempty(pl) | |
75 pl = buildplist(); | |
76 end | |
77 plout = pl; | |
78 end | |
79 | |
80 function pl = buildplist() | |
81 pl = plist.EMPTY_PLIST; | |
82 end | |
83 |