Mercurial > hg > ltpda
view testing/utp_1.1/utp_fcns/get_random_unit.m @ 52:daf4eab1a51e database-connection-manager tip
Fix. Default password should be [] not an empty string
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:29:47 +0100 |
parents | 409a22968d5e |
children |
line wrap: on
line source
% GET_RANDOM_UNIT returns a random unit object, with random unit and random % prefix (if the unit is different from '') % % CALL: u = get_test_ples % % OUTPUTS: u - a unit object with random unit and prefix % % VERSION: $Id: get_random_unit.m,v 1.2 2010/05/05 04:21:52 mauro Exp $ % function u = get_random_unit(varargin) unit_list = unit.supportedUnits; prefix_list = unit.supportedPrefixes; u = cell2mat(utils.math.randelement(unit_list,1)); pref = true; if nargin switch varargin{1} case {'nopref', 'noprefix', 'no_pref', 'no_prefix'} pref = false; otherwise end end % Add a prefix only if the unit is different from '' if pref && ~isempty(u) && ~strcmpi(u, '') u = unit([cell2mat(utils.math.randelement(prefix_list,1)) u]); else u = unit(u); end end