Home > classes > @history > string.m

string

PURPOSE ^

STRING writes a command string that can be used to recreate the input history object.

SYNOPSIS ^

function cmd = string(hs, varargin)

DESCRIPTION ^

 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.html,v 1.14 2008/03/31 10:27:38 hewitson Exp $

 HISTORY:     29-03-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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.html,v 1.14 2008/03/31 10:27:38 hewitson Exp $
0016 %
0017 % HISTORY:     29-03-2007 M Hewitson
0018 %                 Creation
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 VERSION  = '$Id: string.html,v 1.14 2008/03/31 10:27:38 hewitson Exp $';
0023 CATEGORY = 'Output';
0024 
0025 % Check if this is a call for parameters
0026 if nargin == 2
0027   if isa(hs, 'history') && ischar(varargin{1})
0028     in = char(varargin{1});
0029     if strcmp(in, 'Params')
0030       cmd = plist;
0031       return
0032     elseif strcmp(in, 'Version')
0033       cmd = VERSION;
0034       return
0035     elseif strcmp(in, 'Category')
0036       cmd = CATEGORY;
0037       return
0038     end
0039   end
0040 end
0041 
0042 cmd = '[';
0043 
0044 for j=1:length(hs)
0045   h = hs(j);
0046   name = get(h, 'name');
0047   vers = get(h, 'version');
0048   pl   = get(h, 'plist');
0049   hi   = get(h, 'inhists');
0050 
0051   if isempty(pl)
0052     plstr = '[]';
0053   else
0054     plstr = string(pl);
0055   end
0056   if isempty(plstr)
0057     plstr = '[]';
0058   end
0059 
0060   if isempty(hi)
0061     histr = '[]';
0062   else
0063     histr = string(hi);
0064   end
0065   if isempty(histr)
0066     histr = '[]';
0067   end
0068 
0069   cmd = [cmd 'history(' ...
0070              '''' name '''' ', ' ...
0071              '''' vers '''' ', ' ...
0072              plstr ', '  ...
0073              histr  ...
0074              ') '];
0075 end
0076 
0077 cmd = [cmd ']'];
0078 
0079 if strcmp(cmd, '[]')
0080   cmd = '';
0081 end
0082 
0083 % END

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003