Home > classes > @history > string.m

string

PURPOSE ^

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

SYNOPSIS ^

function cmd = string(hs)

DESCRIPTION ^

 STRING writes a command string that can be used to recreate the input
 history object.
 
 M Hewitson 29-03-07
 
 $Id: string.html,v 1.1 2007/06/08 14:15:05 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cmd = string(hs)
0002 
0003 % STRING writes a command string that can be used to recreate the input
0004 % history object.
0005 %
0006 % M Hewitson 29-03-07
0007 %
0008 % $Id: string.html,v 1.1 2007/06/08 14:15:05 hewitson Exp $
0009 %
0010 
0011 cmd = '[';
0012 
0013 for j=1:length(hs)
0014   h = hs(j);
0015   name = get(h, 'name');
0016   vers = get(h, 'version');
0017   pl   = get(h, 'plist');
0018   hi   = get(h, 'inhists');
0019 
0020   if isempty(pl)
0021     plstr = '[]';
0022   else
0023     plstr = string(pl);
0024   end
0025   if isempty(plstr)
0026     plstr = '[]';
0027   end
0028   
0029   if isempty(hi)
0030     histr = '[]';
0031   else
0032     histr = string(hi);
0033   end
0034   if isempty(histr)
0035     histr = '[]';
0036   end
0037   
0038   cmd = [cmd 'history(' ...
0039              '''' name '''' ', ' ...
0040              '''' vers '''' ', ' ...
0041              plstr ', '  ...
0042              histr  ...
0043              ') '];
0044 end
0045 
0046 cmd = [cmd ']'];
0047 
0048 if strcmp(cmd, '[]')
0049   cmd = '';
0050 end
0051 
0052 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003