Mercurial > hg > ltpda
view m-toolbox/classes/@ltpda_uo/setUUID.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line source
% SETUUID Set the property 'UUID' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: SETUUID Set the property 'UUID' % % CALL: objs.setUUID('new UUID'); % objs = setUUID(objs, 'new UUID'); % % INPUTS: objs - is a general object % % REMARK: This method doesn't add history because it is only for % internal usage. e.g. in addHistoryStep. % % VERSION: $Id: setUUID.m,v 1.4 2011/03/25 13:24:46 ingo Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function objs = setUUID(objs, val) if nargin<2 val = {char(java.util.UUID.randomUUID)}; else val = cellstr(val); end % Replicate the values in 'val' to the number of AOs if numel(val) <= 1 && numel(objs) ~= 1 val = cell(size(objs)); val = cellfun(@(x) char(java.util.UUID.randomUUID), val, 'UniformOutput', false); end %%% decide whether we modify the ltpda_uo-object, or create a new one. objs = copy(objs, nargout); %%% set 'UUID' for ii=1:numel(objs) objs(ii).UUID = val{ii}; end end