comparison m-toolbox/classes/@paramValue/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 display a parameter value
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DISPLAY display a parameter value
5 % Is called for the parameter value object when the semicolon is not used.
6 %
7 % CALL: paramValue(1, {pi}, 0)
8 % txt = display(paramValue(1, {pi}, 0));
9 %
10 % VERSION: $Id: display.m,v 1.4 2011/02/18 16:48:53 ingo Exp $
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function varargout = display(varargin)
15
16 objs = [varargin{:}];
17
18 txt = {};
19 MAX_DISP = 60;
20
21 for ii = 1:numel(objs)
22 banner = sprintf('---- paramValue %d ----', ii);
23 txt{end+1} = banner;
24
25 %%%%%%%%%%%%%%%%%%%% Add Property 'key' %%%%%%%%%%%%%%%%%%%%
26 if (objs(ii).valIndex >= 1)
27 txt{end+1} = sprintf('used value: %s', utils.helper.val2str(objs(ii).getVal, 60));
28 txt{end+1} = ' ';
29 end
30
31 options = utils.helper.val2str(objs(ii).options, MAX_DISP);
32
33 txt{end+1} = sprintf(' val index: %s', mat2str(objs(ii).valIndex));
34 txt{end+1} = sprintf(' options: %s', options);
35 txt{end+1} = sprintf(' selection: %s', paramValue.getSelectionMode(objs(ii).selection));
36
37 names = fieldnames(objs(ii).property);
38 for nn = 1:numel(names)
39 txt{end+1} = sprintf('%10s: %s', names{nn}, utils.helper.val2str(objs(ii).property.(names{nn})));
40 end
41
42 banner_end(1:length(banner)) = '-';
43 txt{end+1} = banner_end;
44
45 end
46
47 %%% Prepare output
48 if nargout == 0
49 for ii=1:length(txt)
50 disp(sprintf(txt{ii}));
51 end
52 elseif nargout == 1
53 varargout{1} = txt;
54 end
55
56 end
57