function mode = whatmode(input)

% WHATMODE - determine the operating mode of makelist
%
% mode = whatmode(input)
%
% input     input arguments to makelist
%
% mode      operating mode of makelist

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

% DETERMINE length of input variables
% DETERMINE mode from length of input variables and their class

mode = [];

% Determine length of input variables
inputLength = length(input);

% Determine mode from length of input variables
if inputLength == 1 
    mode = 1; % varargin = (inputFileName)
    % Read line-by-line from file; angles may not be 'OPTIMAL'
elseif inputLength == 2
    temp1 = input{1};
    temp2 = input{2};
    if strcmp(class(temp1), 'double') & strcmp(class(temp2), 'char')
        mode = 2; % varargin = (nSim, inputFileName)
        % Make nSim draws on the lines of the file; angles may not be
        % 'OPTIMAL'
    elseif strcmp(class(temp1), 'char') & strcmp(class(temp2), 'char')
        mode = 3; % varargin = (inputFileName, detId)
        % Read line-by-line from a file; angles may be 'OPTIMAL'
    else
        error(['makelist -> whatmode: Error in input: varargin = '...
                '(nSim, inputFileName) | varargin(inputFileName, detId)'])
    end
elseif inputLength == 3
    mode = 4; % varargin = (nSim, inputFileName, detId)
    % Make nSim draws on the lines of the file; angles may be 'OPTIMAL'
elseif inputLength == 6
    mode = 5; % varargin = (nSim, simId, ampl, startSamp, internal, external)
    % Variables directly input into makelist; external may not be 'OPTIMAL'
elseif inputLength == 7
    mode = 6; 
    % varargin = (nSim, simId, ampl, startSamp, internal, external, detId)
    % Variables directly input into makelist; external may be 'OPTIMAL'
else
    error(['makelist -> whatmode: varargin = (inputFileName) | '...
            '(nSim, inputFileName) | (inputFileName, detId) | '...
            '(nSim, inputFileName, detId) | (nSim, simId, ampl, '...
            'startSamp, internal, external) | (nSim, simId, ampl, '...
            'startSamp, internal, external, detId)'])
end

return