comparison m-toolbox/classes/@history/string.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 % STRING writes a command string that can be used to recreate the input history object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: STRING writes a command string that can be used to recreate the
5 % input history object.
6 %
7 % CALL: cmd = string(history_obj)
8 %
9 % INPUT: history_obj - history object
10 %
11 % OUTPUT: cmd - command string to create the input object
12 %
13 % VERSION: $Id: string.m,v 1.11 2011/02/18 16:48:52 ingo Exp $
14 %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
17 function varargout = string(varargin)
18
19 objs = [varargin{:}];
20
21 cmd = '';
22
23 for ii = 1:numel(objs)
24 hh = objs(ii);
25 m_info = hh.methodInfo;
26 pl_used = hh.plistUsed;
27 in_hist = hh.inhists;
28
29 %%% Create minfo string
30 if isempty(m_info)
31 minfo_str = '[]';
32 else
33 minfo_str = string(m_info);
34 end
35
36 %%% Create plist string
37 if isempty(pl_used)
38 pl_str = '[]';
39 else
40 pl_str = string(pl_used);
41 end
42
43 %%% Create history string
44 if isempty(in_hist)
45 hi_str = '[]';
46 else
47 hi_str = string(in_hist);
48 end
49 if isempty(hi_str)
50 hi_str = '[]';
51 end
52
53 cmd = [cmd 'history(' minfo_str, ', ' pl_str, ', ' hi_str, ') '];
54 end
55
56 if numel(objs) > 1
57 cmd = ['[ ' cmd ']'];
58 end
59
60 varargout{1} = cmd;
61 end
62