0001 function list = pregenlist(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 list = {};
0044
0045
0046 if length(varargin) ~= 4 & length(varargin) ~= 5
0047 error(['pregenlist: varargin can only be [inputFileName, ' ...
0048 'startSamp, external, detId] or [nSim, inputFileName, ' ...
0049 'startSamp, external, detId]'])
0050 elseif length(varargin) == 4
0051 [inputFileName, startSamp, external, detId] = deal(varargin{:});
0052
0053 nSim = size(inputFileName, 1);
0054 elseif length(varargin) == 5
0055 [nSim, inputFileName, startSamp, external, detId] = deal(varargin{:});
0056 inputFileName = repmat(inputFileName, nSim, 1);
0057 startSamp = repmat(startSamp, nSim, 1);
0058 external = repmat(external, nSim, 1);
0059 end
0060
0061 for iSim = 1:nSim
0062
0063 if strcmp(class(inputFileName(iSim,:)), 'cell') & ...
0064 length(inputFileName(iSim,:)) == 1
0065 simId{iSim} = [inputFileName{iSim,1}];
0066 if ~strcmp(class(simId{iSim}), 'char')
0067 simId{iSim}
0068 error('pregenlist: simId must be a string')
0069 end
0070 elseif strcmp(class(inputFileName(iSim,:)), 'cell') & ...
0071 length(inputFileName(iSim,:)) == 2
0072 simId{iSim}= [inputFileName{iSim,1} ',' inputFileName{iSim,2}];
0073 if ~strcmp(class(simId{iSim}), 'char')
0074 simId{iSim}
0075 error('pregenlist: simId must be a string')
0076 end
0077 elseif strcmp(class(inputFileName(iSim,:)), 'cell') & ...
0078 length(inputFileName(iSim,:)) == 4
0079 simId{iSim}= [inputFileName{iSim,1} ',' inputFileName{iSim,2} ';' inputFileName{iSim,3} ',' inputFileName{iSim,4}];
0080 if ~strcmp(class(simId{iSim}), 'char')
0081 simId{iSim}
0082 error('pregenlist: simId must be a string')
0083 end
0084 elseif strcmp(class(inputFileName(iSim,:)), 'char')
0085 simId{iSim} = [inputFileName(iSim,:)];
0086 else
0087 inputFileName{iSim}
0088 error('pregenlist: simId must be either cell or char class')
0089 end
0090
0091
0092 ampl(iSim) = -1;
0093
0094
0095
0096
0097 [startSamp1(iSim), startSamp2(iSim)] = deal(startSamp(iSim,1), ...
0098 startSamp(iSim,2));
0099 nuStartSamp(iSim) = pickstime(startSamp1(iSim), startSamp2(iSim));
0100 if isempty(startSamp(iSim))
0101 error('pregenlist: pickstime returned empty startSamp')
0102 end
0103
0104
0105
0106 int1(iSim) = 1;
0107 int2(iSim) = 0;
0108
0109
0110 if ~strcmp(class(external), 'cell')
0111 nuExternal(iSim,:) = setexternal(-2, external(iSim,:), 1, detId);
0112 elseif strcmp(class(external), 'cell')
0113 nuExternal(iSim,:) = setexternal(-1, external{iSim}, 1, detId);
0114 end
0115
0116 if isempty(external)
0117 error('pregenlist: setexternal returned empty external')
0118 end
0119
0120 end
0121
0122
0123 for k=1:size(simId,2)
0124 list(k,:) = {simId{:,k}, ampl(k), nuStartSamp(k), int1(k), int2(k),...
0125 nuExternal(k,1), nuExternal(k,2), nuExternal(k,3)};
0126 end
0127
0128 return