Home > classes > @history > string.m

string

PURPOSE ^

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

SYNOPSIS ^

function varargout = string(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

 M-FILE INFO: Get information about this methods by calling
              >> history.getInfo('string')

              Get information about a specified set-plist by calling:
              >> history.getInfo('string', 'set')

 VERSION:     $Id: string.m,v 1.8 2008/09/04 15:29:30 ingo Exp $

 HISTORY:     29-03-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % STRING writes a command string that can be used to recreate the input history object.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: STRING writes a command string that can be used to recreate the
0005 %              input history object.
0006 %
0007 % CALL:        cmd = string(history_obj)
0008 %
0009 % INPUT:       history_obj - history object
0010 %
0011 % OUTPUT:      cmd         - command string to create the input object
0012 %
0013 % M-FILE INFO: Get information about this methods by calling
0014 %              >> history.getInfo('string')
0015 %
0016 %              Get information about a specified set-plist by calling:
0017 %              >> history.getInfo('string', 'set')
0018 %
0019 % VERSION:     $Id: string.m,v 1.8 2008/09/04 15:29:30 ingo Exp $
0020 %
0021 % HISTORY:     29-03-2007 M Hewitson
0022 %                 Creation
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 function varargout = string(varargin)
0027 
0028   %%% Check if this is a call for parameters
0029   if utils.helper.isinfocall(varargin{:})
0030     varargout{1} = getInfo(varargin{3});
0031     return
0032   end
0033 
0034   objs = utils.helper.collect_objects(varargin(:), 'history');
0035 
0036   cmd = '';
0037 
0038   for ii = 1:numel(objs)
0039     hh = objs(ii);
0040     m_info  = hh.methodInfo;
0041     pl_used = hh.plistUsed;
0042     in_hist = hh.inhists;
0043 
0044     %%% Create minfo string
0045     if isempty(m_info)
0046       minfo_str = '[]';
0047     else
0048       minfo_str = string(m_info);
0049     end
0050 
0051     %%% Create plist string
0052     if isempty(pl_used)
0053       pl_str = '[]';
0054     else
0055       pl_str = string(pl_used);
0056     end
0057 
0058     %%% Create history string
0059     if isempty(in_hist)
0060       hi_str = '[]';
0061     else
0062       hi_str = string(in_hist);
0063     end
0064     if isempty(hi_str)
0065       hi_str = '[]';
0066     end
0067 
0068     cmd = [cmd 'history(' minfo_str, ', ' pl_str, ', '  hi_str,  ') '];
0069   end
0070 
0071   if numel(objs) > 1
0072     cmd = ['[ ' cmd ']'];
0073   end
0074 
0075   varargout{1} = cmd;
0076 end
0077 
0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0079 %                               Local Functions                               %
0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0081 
0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0083 %
0084 % FUNCTION:    getInfo
0085 %
0086 % DESCRIPTION: Get Info Object
0087 %
0088 % HISTORY:     11-07-07 M Hewitson
0089 %                Creation.
0090 %
0091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0092 
0093 function ii = getInfo(varargin)
0094   if nargin == 1 && strcmpi(varargin{1}, 'None')
0095     sets = {};
0096     pl   = [];
0097   else
0098     sets = {'Default'};
0099     pl   = getDefaultPlist;
0100   end
0101   % Build info object
0102   ii = minfo(mfilename, 'history', '', utils.const.categories.output, '$Id: string.m,v 1.8 2008/09/04 15:29:30 ingo Exp $', sets, pl);
0103 end
0104 
0105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0106 %
0107 % FUNCTION:    getDefaultPlist
0108 %
0109 % DESCRIPTION: Get Default Plist
0110 %
0111 % HISTORY:     11-07-07 M Hewitson
0112 %                Creation.
0113 %
0114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0115 
0116 function plo = getDefaultPlist()
0117   plo = plist();
0118 end
0119

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003