0001 function pl = set(pl, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 VERSION = '$Id: set.m,v 1.11 2008/01/02 17:58:51 ingo Exp $';
0023
0024
0025 if nargin == 2
0026 if isa(pl, 'plist') && ischar(varargin{1})
0027 in = varargin{1};
0028 if strcmp(in, 'Params')
0029 pl = plist();
0030 return
0031 elseif strcmp(in, 'Version')
0032 pl = VERSION;
0033 return
0034 end
0035 end
0036 end
0037
0038 if (nargout ~= 0)
0039
0040 propArgin = varargin;
0041
0042 while length(propArgin) >= 2
0043 prop = propArgin{1};
0044 val = propArgin{2};
0045 propArgin = propArgin(3:end);
0046 switch prop
0047 case 'params'
0048 pl.params = val;
0049 case 'version'
0050 pl.version = val;
0051 case 'name'
0052 pl.name = val;
0053 case 'created'
0054 if isa(val, 'time')
0055 pl.created = val;
0056 else
0057 error('### The property ''created'' must be a time-object');
0058 end
0059 otherwise
0060 error('### The [%s] is not a property of the plist class.\n### To set a key/value pair use the function pset.', prop);
0061
0062 end
0063 end
0064
0065 else
0066 if ischar(varargin{2})
0067 error('### please use: %s = set(%s, ''%s'', ''%s'');', ...
0068 inputname(1), ...
0069 inputname(1), ...
0070 varargin{1}, ...
0071 varargin{2});
0072 elseif isnumeric(varargin{2})
0073 error('### please use: %s = set(%s, ''%s'', %d);', ...
0074 inputname(1), ...
0075 inputname(1), ...
0076 varargin{1}, ...
0077 varargin{2});
0078 else
0079 error('### please use: %s = set(%s, key, ''value'');', ...
0080 inputname(1), ...
0081 inputname(1));
0082 end
0083 end
0084
0085