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