


DISPLAY overloads display functionality for zero objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: DISPLAY overloads display functionality for zero objects.
CALL: txt = display(zero)
INPUT: zero - zero object
OUTPUT: txt - cell array with strings to display the zero object
VERSION: $Id: display.m,v 1.4 2008/01/02 17:58:51 ingo Exp $
HISTORY: 30-01-2007 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 function txt = display(p, varargin) 0002 % DISPLAY overloads display functionality for zero objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: DISPLAY overloads display functionality for zero objects. 0007 % 0008 % CALL: txt = display(zero) 0009 % 0010 % INPUT: zero - zero object 0011 % 0012 % OUTPUT: txt - cell array with strings to display the zero object 0013 % 0014 % VERSION: $Id: display.m,v 1.4 2008/01/02 17:58:51 ingo Exp $ 0015 % 0016 % HISTORY: 30-01-2007 M Hewitson 0017 % Creation 0018 % 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 0021 VERSION = '$Id: display.m,v 1.4 2008/01/02 17:58:51 ingo Exp $'; 0022 0023 % Check if this is a call for parameters 0024 if nargin == 2 0025 if isa(p, 'zero') && ischar(varargin{1}) 0026 in = char(varargin{1}); 0027 if strcmp(in, 'Params') 0028 txt = plist(); 0029 return 0030 elseif strcmp(in, 'Version') 0031 txt = VERSION; 0032 return 0033 end 0034 end 0035 end 0036 0037 txt = {}; 0038 0039 for i=1:numel(p) 0040 banner = sprintf('---- zero %d ----', i); 0041 txt{end+1} = banner; 0042 0043 % get key and value 0044 name = get(p(i), 'name'); 0045 f = get(p(i), 'f'); 0046 q = get(p(i), 'q'); 0047 ri = get(p(i), 'ri'); 0048 0049 % display 0050 if ~isempty(f) 0051 if q > 0.5 0052 txt{end+1} = [ sprintf('%s: %g Hz, Q=%g [', name, f, q) num2str(ri(1)) ']']; 0053 else 0054 txt{end+1} = sprintf('%s: %g Hz', name, f); 0055 end 0056 end 0057 0058 banner_end(1:length(banner)) = '-'; 0059 txt{end+1} = banner_end; 0060 0061 end 0062 0063 if nargout == 0 0064 for ii=1:length(txt) 0065 disp(txt{ii}); 0066 end 0067 end 0068 0069