Home > classes > @param > string.m

string

PURPOSE ^

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

SYNOPSIS ^

function varargout = string(varargin)

DESCRIPTION ^

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

 DESCRIPTION: STRING writes a command string that can be used to recreate the
              input param object.

 CALL:        cmd = string(param_obj)

 INPUT:       param_obj - parameter object

 OUTPUT:      cmd       - command string to create the input object

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

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

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

 HISTORY:     15-02-2008 Diepholz
                 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 param object.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: STRING writes a command string that can be used to recreate the
0005 %              input param object.
0006 %
0007 % CALL:        cmd = string(param_obj)
0008 %
0009 % INPUT:       param_obj - parameter 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 %              >> param.getInfo('string')
0015 %
0016 %              Get information about a specified set-plist by calling:
0017 %              >> param.getInfo('string', 'set')
0018 %
0019 % VERSION:     $Id: string.m,v 1.7 2008/09/04 15:29:31 ingo Exp $
0020 %
0021 % HISTORY:     15-02-2008 Diepholz
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(:), 'param');
0035 
0036   cmd = '';
0037 
0038   for ii = 1:numel(objs)
0039 
0040     key = objs(ii).key;
0041     val = objs(ii).val;
0042 
0043     if ischar(val)
0044       val_str = ['''' val ''''];
0045     elseif isnumeric(val)
0046       val_str = utils.helper.mat2str(val);
0047     elseif isobject(val)
0048       val_str = string(val);
0049     else
0050       error('### Unknown object [%s]', class(val));
0051     end
0052 
0053     cmd = [cmd 'param(''' key ''', ' val_str ') '];
0054   end
0055 
0056   %%% Wrap the command only in bracket if the there are more than one object
0057   if numel(objs) > 1
0058     cmd = ['[' cmd(1:end-1) ']'];
0059   end
0060 
0061   %%% Prepare output
0062   varargout{1} = cmd;
0063 end
0064 
0065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0066 %                               Local Functions                               %
0067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0068 
0069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0070 %
0071 % FUNCTION:    getInfo
0072 %
0073 % DESCRIPTION: Get Info Object
0074 %
0075 % HISTORY:     11-07-07 M Hewitson
0076 %                Creation.
0077 %
0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0079 
0080 function ii = getInfo(varargin)
0081   if nargin == 1 && strcmpi(varargin{1}, 'None')
0082     sets = {};
0083     pl   = [];
0084   else
0085     sets = {'Default'};
0086     pl   = getDefaultPlist;
0087   end
0088   % Build info object
0089   ii = minfo(mfilename, 'param', '', utils.const.categories.output, '$Id: string.m,v 1.7 2008/09/04 15:29:31 ingo Exp $', sets, pl);
0090 end
0091 
0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0093 %
0094 % FUNCTION:    getDefaultPlist
0095 %
0096 % DESCRIPTION: Get Default Plist
0097 %
0098 % HISTORY:     11-07-07 M Hewitson
0099 %                Creation.
0100 %
0101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0102 
0103 function plo = getDefaultPlist()
0104   plo = plist();
0105 end
0106

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