


STRING writes a command string that can be used to recreate the input history object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: STRING writes a command string that can be used to recreate the
input history object.
CALL: cmd = string(history_obj)
INPUT: history_obj - history object
OUTPUT: cmd - command string to create the input object
VERSION: $Id: string.m,v 1.3 2007/12/05 16:26:22 ingo Exp $
HISTORY: 29-03-2007 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 function cmd = string(hs, varargin) 0002 % STRING writes a command string that can be used to recreate the input history object. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: STRING writes a command string that can be used to recreate the 0007 % input history object. 0008 % 0009 % CALL: cmd = string(history_obj) 0010 % 0011 % INPUT: history_obj - history object 0012 % 0013 % OUTPUT: cmd - command string to create the input object 0014 % 0015 % VERSION: $Id: string.m,v 1.3 2007/12/05 16:26:22 ingo Exp $ 0016 % 0017 % HISTORY: 29-03-2007 M Hewitson 0018 % Creation 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 0022 VERSION = '$Id: string.m,v 1.3 2007/12/05 16:26:22 ingo Exp $'; 0023 0024 % Check if this is a call for parameters 0025 if nargin == 2 0026 if isa(hs, 'history') && ischar(varargin{1}) 0027 in = char(varargin{1}); 0028 if strcmp(in, 'Params') 0029 cmd = plist; 0030 return 0031 elseif strcmp(in, 'Version') 0032 cmd = VERSION; 0033 return 0034 end 0035 end 0036 end 0037 0038 cmd = '['; 0039 0040 for j=1:length(hs) 0041 h = hs(j); 0042 name = get(h, 'name'); 0043 vers = get(h, 'version'); 0044 pl = get(h, 'plist'); 0045 hi = get(h, 'inhists'); 0046 0047 if isempty(pl) 0048 plstr = '[]'; 0049 else 0050 plstr = string(pl); 0051 end 0052 if isempty(plstr) 0053 plstr = '[]'; 0054 end 0055 0056 if isempty(hi) 0057 histr = '[]'; 0058 else 0059 histr = string(hi); 0060 end 0061 if isempty(histr) 0062 histr = '[]'; 0063 end 0064 0065 cmd = [cmd 'history(' ... 0066 '''' name '''' ', ' ... 0067 '''' vers '''' ', ' ... 0068 plstr ', ' ... 0069 histr ... 0070 ') ']; 0071 end 0072 0073 cmd = [cmd ']']; 0074 0075 if strcmp(cmd, '[]') 0076 cmd = ''; 0077 end 0078 0079 % END