STRING converts a unit object to a command string which will recreate the unit object. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: STRING converts a unit object to a command string which will recreate the unit object. CALL: cmd = string(u) M-FILE INFO: Get information about this methods by calling >> unit.getInfo('string') Get information about a specified set-plist by calling: >> unit.getInfo('string', 'set') VERSION: $Id: string.m,v 1.1 2008/09/05 14:10:15 hewitson Exp $ HISTORY: 29-03-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % STRING converts a unit object to a command string which will recreate the unit object. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: STRING converts a unit object to a command string which will 0005 % recreate the unit object. 0006 % 0007 % CALL: cmd = string(u) 0008 % 0009 % M-FILE INFO: Get information about this methods by calling 0010 % >> unit.getInfo('string') 0011 % 0012 % Get information about a specified set-plist by calling: 0013 % >> unit.getInfo('string', 'set') 0014 % 0015 % VERSION: $Id: string.m,v 1.1 2008/09/05 14:10:15 hewitson Exp $ 0016 % 0017 % HISTORY: 29-03-2007 M Hewitson 0018 % Creation 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 0022 function varargout = string(varargin) 0023 0024 %%% Check if this is a call for parameters 0025 if utils.helper.isinfocall(varargin{:}) 0026 varargout{1} = getInfo(varargin{3}); 0027 return 0028 end 0029 0030 objs = utils.helper.collect_objects(varargin(:), 'unit'); 0031 0032 pstr = '[ '; 0033 0034 for ii = 1:numel(objs) 0035 pstr = [pstr 'unit(''']; 0036 pstr = [pstr strrep(strrep(char(objs(ii)), '[', ' '), ']', ' ')]; 0037 pstr = [pstr ''') ']; 0038 0039 end 0040 0041 pstr = [pstr ']']; 0042 0043 varargout{1} = pstr; 0044 end 0045 0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0047 % Local Functions % 0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0049 0050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0051 % 0052 % FUNCTION: getInfo 0053 % 0054 % DESCRIPTION: Get Info Object 0055 % 0056 % HISTORY: 11-07-07 M Hewitson 0057 % Creation. 0058 % 0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0060 0061 function ii = getInfo(varargin) 0062 if nargin == 1 && strcmpi(varargin{1}, 'None') 0063 sets = {}; 0064 pl = []; 0065 else 0066 sets = {'Default'}; 0067 pl = getDefaultPlist; 0068 end 0069 % Build info object 0070 ii = minfo(mfilename, 'unit', '', utils.const.categories.helper, '$Id: string.m,v 1.1 2008/09/05 14:10:15 hewitson Exp $', sets, pl); 0071 end 0072 0073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0074 % 0075 % FUNCTION: getDefaultPlist 0076 % 0077 % DESCRIPTION: Get Default Plist 0078 % 0079 % HISTORY: 11-07-07 M Hewitson 0080 % Creation. 0081 % 0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0083 0084 function plo = getDefaultPlist() 0085 plo = plist(); 0086 end 0087