comparison m-toolbox/classes/@pzmodel/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 pzmodel objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY overloads display functionality for pzmodel objects.
5 %
6 % CALL: txt = display(pzmodel)
7 %
8 % INPUT: pzmodel - pole/zero model object
9 %
10 % OUTPUT: txt - cell array with strings to display the pole/zero model object
11 %
12 % <a href="matlab:utils.helper.displayMethodInfo('pzmodel', 'display')">Parameters Description</a>
13 %
14 % VERSION: $Id: display.m,v 1.27 2011/04/08 08:56:32 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(:), 'pzmodel');
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('---- pzmodel %d ----', i);
41 txt{end+1} = banner;
42
43 % get key and value
44 name = objs(i).name;
45 desc = objs(i).description;
46 g = objs(i).gain;
47 del = objs(i).delay;
48 ps = objs(i).poles;
49 zs = objs(i).zeros;
50 np = numel(ps);
51 nz = numel(zs);
52 iunit = char(objs(i).iunits);
53 ounit = char(objs(i).ounits);
54
55 % display
56 txt{end+1} = [' name: ' name];
57 txt{end+1} = [' gain: ' num2str(g)];
58 txt{end+1} = [' delay: ' num2str(del)];
59 txt{end+1} = [' iunits: ' iunit];
60 txt{end+1} = [' ounits: ' ounit];
61 txt{end+1} = ['description: ' desc];
62 txt{end+1} = [' UUID: ' objs(i).UUID];
63
64 for j=1:np
65 txt{end+1} = [sprintf('pole %03d: ', j) char(ps(j)) ];
66 end
67 for j=1:nz
68 txt{end+1} = [sprintf('zero %03d: ', j) char(zs(j)) ];
69 end
70
71 banner_end(1:length(banner)) = '-';
72 txt{end+1} = banner_end;
73 end
74
75 if nargout == 0
76 for ii=1:length(txt)
77 disp(txt{ii});
78 end
79 else
80 varargout{1} = txt;
81 end
82
83 end
84
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86 % Local Functions %
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 %
91 % FUNCTION: getInfo
92 %
93 % DESCRIPTION: Get Info Object
94 %
95 % HISTORY: 11-07-07 M Hewitson
96 % Creation.
97 %
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99
100 function ii = getInfo(varargin)
101 if nargin == 1 && strcmpi(varargin{1}, 'None')
102 sets = {};
103 pl = [];
104 else
105 sets = {'Default'};
106 pl = getDefaultPlist;
107 end
108 % Build info object
109 ii = minfo(mfilename, 'pzmodel', 'ltpda', utils.const.categories.output, '$Id: display.m,v 1.27 2011/04/08 08:56:32 hewitson Exp $', sets, pl);
110 ii.setModifier(false);
111 ii.setOutmin(0);
112 end
113
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 %
116 % FUNCTION: getDefaultPlist
117 %
118 % DESCRIPTION: Get Default Plist
119 %
120 % HISTORY: 11-07-07 M Hewitson
121 % Creation.
122 %
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124
125 function plout = getDefaultPlist()
126 persistent pl;
127 if exist('pl', 'var')==0 || isempty(pl)
128 pl = buildplist();
129 end
130 plout = pl;
131 end
132
133 function pl = buildplist()
134 pl = plist.EMPTY_PLIST;
135 end
136