function [simId, ampl, startSamp1, startSamp2, int1, int2, ext1, ext2, ...
        ext3] = ndraws(nSim, tempList)

% NDRAWS - make random draws on information from file
%
% [simId, ampl, startSamp1, startSamp2, int1, int2, ext1, ext2, ext3] ...
%       = ndraws(nSim, tempList)
%
% nSim      number of draws to make on tempList
% tempList  cell array containing all data read from file
%
% simId         signal types
% ampl          signal amplitudes
% startSamp1    minimum start times in samples
% startSamp2    maximum start times in samples
% int1          first internal angles
% int2          second internal angles
% ext1          first external angles
% ext2          second internal angles
% ext3          third internal angles

% $Id: ndraws.m,v 1.2 2004/05/10 20:26:12 stuver Exp $

% DETERMINE number of rows in tempList
% DRAW nSim times on the lines of tempList
% RETURN variable lists

mTempList = size(tempList, 1); % Number of rows (simulations) in tempList
if mTempList == 0
    error('makelist -> ndraws: tempList has zero length')
end

% Make nSim draws on tempList
for iSim = 1:nSim
    % Select row from tempList to put into nuTempList
    nuTempList(iSim,:) = tempList(fix(rand(1)*mTempList)+1,:);
    % Assign variables from nuTempList
    simId(iSim,:) = nuTempList{iSim,1};
    ampl(iSim,:) = nuTempList{iSim,2};
    startSamp1(iSim,:) = nuTempList{iSim,3};
    startSamp2(iSim,:) = nuTempList{iSim,4};
    int1(iSim,:) = nuTempList{iSim,5};
    int2(iSim,:) = nuTempList{iSim,6};
    ext1(iSim,:) = nuTempList{iSim,7};
    ext2(iSim,:) = nuTempList{iSim,8};
    ext3(iSim,:) = nuTempList{iSim,9};
end

return