COPY Make copy of plist objects depending of the second input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: COPY Make copy of plist objects depending of the second input CALL: objs = copy(objs, [1,0]); M-FILE INFO: Get information about this methods by calling >> plist.getInfo('copy') VERSION: $Id: copy.m,v 1.7 2008/09/03 16:29:33 hewitson Exp $ HISTORY: 11-07-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % COPY Make copy of plist objects depending of the second input 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: COPY Make copy of plist objects depending of the second input 0005 % 0006 % CALL: objs = copy(objs, [1,0]); 0007 % 0008 % M-FILE INFO: Get information about this methods by calling 0009 % >> plist.getInfo('copy') 0010 % 0011 % VERSION: $Id: copy.m,v 1.7 2008/09/03 16:29:33 hewitson Exp $ 0012 % 0013 % HISTORY: 11-07-2008 Diepholz 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 function varargout = copy(old, deepcopy) 0019 0020 if deepcopy 0021 % Reset these values on copy 0022 prov = provenance; 0023 t0 = time; 0024 s = size(old); 0025 obj(s(1),s(2)) = plist; 0026 for kk=1:numel(old) 0027 utils.helper.msg(utils.const.msg.OPROC2, 'copying %s', old(kk).name); 0028 if ~isempty(old(kk).params) 0029 obj(kk).params = copy(old(kk).params, 1); 0030 end 0031 obj(kk).name = old(kk).name; 0032 obj(kk).created = t0; 0033 obj(kk).creator = prov; 0034 obj(kk).version = plist.VEROUT; 0035 end 0036 else 0037 obj = old; 0038 end 0039 varargout{1} = obj; 0040 end 0041