0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 function objs = generic_set(objs, propArgin, DEFAULT_PLIST, VERSION, CATEGORY)
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 fields = fieldnames(objs);
0028
0029
0030 if length(fields) ~= nparams(DEFAULT_PLIST)
0031 error('\n### The DEFAULT_PLIST doesn''t contain all field names of the %s-class!', class(objs));
0032 end
0033
0034
0035 if length(propArgin) == 1 && ischar(propArgin{1})
0036 in = propArgin;
0037 if strcmp(in, 'Params')
0038 objs = DEFAULT_PLIST;
0039 return
0040 elseif strcmp(in, 'Version')
0041 objs = VERSION;
0042 return
0043 elseif strcmp(in, 'Category')
0044 objs = CATEGORY;
0045 return
0046 end
0047 end
0048
0049 if isempty(propArgin)
0050 propArgin = {plist()};
0051 end
0052
0053 if nargin >= 2 && isa(propArgin{1}, 'plist')
0054 pl = propArgin{1};
0055 propArgin = {};
0056 for ii = 1:nparams(pl)
0057
0058
0059
0060 propArgin{end+1} = lower(pl.params(ii).key);
0061 propArgin{end+1} = pl.params(ii).val;
0062 end
0063 end
0064
0065 while length(propArgin) >= 2
0066
0067 prop = propArgin{1};
0068 val = propArgin{2};
0069 propArgin = propArgin(3:end);
0070
0071
0072 for jj = 1:numel(objs)
0073 try
0074 objs(jj).(prop) = val;
0075 catch
0076 error('### ''%s'' is not a valid %s-object property.', prop, class(objs));
0077 end
0078
0079 end
0080 end
0081