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)

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.m,v 1.2 2007/07/18 13:58:44 ingo 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)
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.2 2007/07/18 13:58:44 ingo Exp $
0016 %
0017 % HISTORY: 29-03-2007 M Hewitson
0018 %             Creation
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 cmd = '[';
0023 
0024 for j=1:length(hs)
0025   h = hs(j);
0026   name = get(h, 'name');
0027   vers = get(h, 'version');
0028   pl   = get(h, 'plist');
0029   hi   = get(h, 'inhists');
0030 
0031   if isempty(pl)
0032     plstr = '[]';
0033   else
0034     plstr = string(pl);
0035   end
0036   if isempty(plstr)
0037     plstr = '[]';
0038   end
0039 
0040   if isempty(hi)
0041     histr = '[]';
0042   else
0043     histr = string(hi);
0044   end
0045   if isempty(histr)
0046     histr = '[]';
0047   end
0048 
0049   cmd = [cmd 'history(' ...
0050              '''' name '''' ', ' ...
0051              '''' vers '''' ', ' ...
0052              plstr ', '  ...
0053              histr  ...
0054              ') '];
0055 end
0056 
0057 cmd = [cmd ']'];
0058 
0059 if strcmp(cmd, '[]')
0060   cmd = '';
0061 end
0062 
0063 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003