comparison m-toolbox/classes/@parfrac/display.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 % DISPLAY overloads display functionality for parfrac objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY overloads display functionality for parfrac objects.
5 %
6 % CALL: txt = display(pf)
7 %
8 % INPUT: pf - partial fraction (parfrac) transfer function object
9 %
10 % OUTPUT: txt - cell array with strings to display the rat object
11 %
12 % <a href="matlab:utils.helper.displayMethodInfo('parfrac', 'display')">Parameters Description</a>
13 %
14 % VERSION: $Id: display.m,v 1.17 2011/04/08 08:56:33 hewitson Exp $
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function varargout = display(varargin)
19
20 %%% Check if this is a call for parameters
21 if utils.helper.isinfocall(varargin{:})
22 varargout{1} = getInfo(varargin{3});
23 return
24 end
25
26 objs = utils.helper.collect_objects(varargin(:), 'parfrac');
27
28 txt = {};
29
30 % Print emtpy object
31 if isempty(objs)
32 hdr = sprintf('------ %s -------', class(objs));
33 ftr(1:length(hdr)) = '-';
34 txt = [txt; {hdr}];
35 txt = [txt; sprintf('empty-object [%d,%d]',size(objs))];
36 txt = [txt; {ftr}];
37 end
38
39 for i=1:numel(objs)
40 banner = sprintf('---- parfrac %d ----', i);
41 txt{end+1} = banner;
42
43 % get key and value
44 name = objs(i).name;
45 desc = objs(i).description;
46 iunit = char(objs(i).iunits);
47 ounit = char(objs(i).ounits);
48
49 % display
50 txt{end+1} = ['model: ' name];
51 txt{end+1} = ['res: ' mat2str(objs(i).res)];
52 txt{end+1} = ['poles: ' mat2str(objs(i).poles)];
53 txt{end+1} = ['dir: ' mat2str(objs(i).dir)];
54 txt{end+1} = ['pmul: ' mat2str(objs(i).pmul)];
55 txt{end+1} = ['iunits: ' iunit];
56 txt{end+1} = ['ounits: ' ounit];
57 txt{end+1} = ['description: ' desc];
58 txt{end+1} = ['UUID: ' objs(i).UUID];
59
60 banner_end(1:length(banner)) = '-';
61 txt{end+1} = banner_end;
62 end
63
64 if nargout == 0
65 for ii=1:length(txt)
66 disp(txt{ii});
67 end
68 else
69 varargout{1} = txt;
70 end
71
72 end
73
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 % Local Functions %
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79 %
80 % FUNCTION: getInfo
81 %
82 % DESCRIPTION: Get Info Object
83 %
84 % HISTORY: 11-07-07 M Hewitson
85 % Creation.
86 %
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
89 function ii = getInfo(varargin)
90 if nargin == 1 && strcmpi(varargin{1}, 'None')
91 sets = {};
92 pl = [];
93 else
94 sets = {'Default'};
95 pl = getDefaultPlist;
96 end
97 % Build info object
98 ii = minfo(mfilename, 'parfrac', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.17 2011/04/08 08:56:33 hewitson Exp $', sets, pl);
99 ii.setModifier(false);
100 ii.setOutmin(0);
101 end
102
103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104 %
105 % FUNCTION: getDefaultPlist
106 %
107 % DESCRIPTION: Get Default Plist
108 %
109 % HISTORY: 11-07-07 M Hewitson
110 % Creation.
111 %
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113
114 function plout = getDefaultPlist()
115 persistent pl;
116 if exist('pl', 'var')==0 || isempty(pl)
117 pl = buildplist();
118 end
119 plout = pl;
120 end
121
122 function pl = buildplist()
123 pl = plist.EMPTY_PLIST;
124 end
125