Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/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 overloads char() function for analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: CHAR overloads char() function for analysis objects. | |
5 % | |
6 % CALL: c = char(ao_in); | |
7 % | |
8 % FORMAT: c = 'ao.name/ao.data.name class(ao.data) [size(ao.data.yaxis)]' | |
9 % | |
10 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'char')">Parameters Description</a> | |
11 % | |
12 % VERSION: $Id: char.m,v 1.31 2011/04/08 08:56:17 hewitson Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function varargout = char(varargin) | |
17 | |
18 callerIsMethod = utils.helper.callerIsMethod; | |
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 import utils.const.* | |
27 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
28 | |
29 if callerIsMethod | |
30 as = [varargin{:}]; | |
31 else | |
32 % collect input variable names | |
33 in_names = cell(size(varargin)); | |
34 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
35 | |
36 % collect all aos and plists | |
37 as = utils.helper.collect_objects(varargin(:), 'ao', in_names); | |
38 end | |
39 | |
40 if isempty(as) | |
41 varargout{1} = sprintf('empty AO object [%dx%d]', size(as)); | |
42 return; | |
43 end | |
44 | |
45 % go through analysis objects | |
46 pstr = []; | |
47 for j=1:numel(as) | |
48 pstr = [pstr as(j).name]; | |
49 % get data type | |
50 if isempty(as(j).data) | |
51 pstr = [pstr '/No data-object, ']; | |
52 else | |
53 pstr = [pstr '/' class(as(j).data)]; | |
54 pstr = [pstr ' ' char(as(j).data) ', ']; | |
55 end | |
56 end | |
57 | |
58 if pstr(end-1) == ',' | |
59 pstr = pstr(1:end-2); | |
60 end | |
61 | |
62 varargout{1} = pstr; | |
63 | |
64 end | |
65 | |
66 %-------------------------------------------------------------------------- | |
67 % Get Info Object | |
68 %-------------------------------------------------------------------------- | |
69 function ii = getInfo(varargin) | |
70 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
71 sets = {}; | |
72 pl = []; | |
73 else | |
74 sets = {'Default'}; | |
75 pl = getDefaultPlist; | |
76 end | |
77 % Build info object | |
78 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.internal, '$Id: char.m,v 1.31 2011/04/08 08:56:17 hewitson Exp $', sets, pl); | |
79 ii.setModifier(false); | |
80 ii.setOutmin(0); | |
81 end | |
82 | |
83 %-------------------------------------------------------------------------- | |
84 % Get Default Plist | |
85 %-------------------------------------------------------------------------- | |
86 | |
87 function plout = getDefaultPlist() | |
88 persistent pl; | |
89 if exist('pl', 'var')==0 || isempty(pl) | |
90 pl = buildplist(); | |
91 end | |
92 plout = pl; | |
93 end | |
94 | |
95 function pl_default = buildplist() | |
96 pl_default = plist.EMPTY_PLIST; | |
97 end | |
98 |