COPY Make copy of ssm objects depending of the second input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: COPY Make copy of ssm objects depending of the second input CALL: objs = copy(objs, [1,0]); objs = copy(objs); Second input is assumed to be 1 VERSION: $Id: copy.m,v 1.10 2008/09/03 16:29:33 hewitson Exp $ HISTORY: 07-08-2008 Grynagier - made second input facultative 11-07-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % COPY Make copy of ssm objects depending of the second input 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: COPY Make copy of ssm objects depending of the second input 0005 % 0006 % CALL: objs = copy(objs, [1,0]); 0007 % objs = copy(objs); Second input is assumed to be 1 0008 % 0009 % VERSION: $Id: copy.m,v 1.10 2008/09/03 16:29:33 hewitson Exp $ 0010 % 0011 % HISTORY: 07-08-2008 Grynagier - made second input facultative 0012 % 11-07-2008 Diepholz 0013 % Creation 0014 % 0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0016 0017 function varargout = copy(old, deepcopy) 0018 0019 %% begin function body 0020 0021 if deepcopy 0022 prov = provenance; 0023 t0 = time; 0024 ps = properties('ssm'); 0025 s = size(old); 0026 obj(s(1),s(2)) = ssm; 0027 for kk=1:numel(old) 0028 utils.helper.msg(utils.const.msg.OPROC2, 'copying %s', old(kk).name); 0029 for jj=1:length(ps) 0030 obj(kk).(ps{jj}) = old(kk).(ps{jj}); 0031 end 0032 % These should be reset on copy 0033 obj(kk).created = t0; 0034 obj(kk).creator = prov; 0035 obj(kk).version = ssm.VEROUT; 0036 end 0037 else 0038 obj = old; 0039 end 0040 varargout{1} = obj; 0041 0042 end 0043