0001 function sublist = make_exp_sublist(expname,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 conn_id = [];
0016 exclude_subs = {};
0017
0018
0019 narg = length(varargin);
0020 for iarg = 1:2:narg
0021
0022 switch varargin{iarg}
0023 case {'exclude_subs'}
0024 exclude_subs = check_cell(varargin{iarg+1});
0025
0026 case 'conn_id'
0027 conn_id = varargin{iarg+1};
0028
0029 otherwise
0030 fprintf('make_exp_sublist: Unknown parameter: %s\', varargin{iarg});
0031 end
0032 end
0033
0034 if ~exist('conn_id','var') || isempty(conn_id)
0035 error('%s: Do not have a valid connection ID', mfilename);
0036 end
0037
0038
0039 expinfo = mysql_get_expinfo(expname,'','',conn_id);
0040
0041 sublist = expinfo.subs.ids;
0042
0043
0044 if ~isempty(exclude_subs)
0045 [sublist] = setdiff(sublist,exclude_subs);
0046 sublist = sublist';
0047 end
0048
0049
0050 if ~conn_id
0051 mysql(conn_id,'close')
0052 end
0053
0054 end
0055
0056 function var = check_cell(var)
0057 if ~iscell(var)
0058 var = {var};
0059 end
0060 end