Mercurial > hg > ltpda
view m-toolbox/classes/@param/copy.m @ 50:7d2e2e065cf1 database-connection-manager
Update unit tests
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:37 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% COPY makes a (deep) copy of the input param objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: COPY makes a deep copy of the input param objects. % % CALL: b = copy(a, flag) % % INPUTS: a - input param object % flag - true: make a deep copy, false: return copies of handles % % OUTPUTS: b - copy of inputs % % VERSION: $Id: copy.m,v 1.18 2011/05/23 20:41:12 mauro Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = copy(old, deepcopy) if deepcopy % Loop over input param objects new = param.newarray(size(old)); for kk = 1:numel(old) if isa(old(kk).val, 'ltpda_obj') new(kk).val = copy(old(kk).val, true); else new(kk).val = old(kk).val; end new(kk).key = old(kk).key; new(kk).desc = old(kk).desc; end else new = old; end varargout{1} = new; end