WHATMODE - determine the operating mode of makelist mode = whatmode(input) input input arguments to makelist mode operating mode of makelist
0001 function mode = whatmode(input) 0002 0003 % WHATMODE - determine the operating mode of makelist 0004 % 0005 % mode = whatmode(input) 0006 % 0007 % input input arguments to makelist 0008 % 0009 % mode operating mode of makelist 0010 0011 % $Id: whatmode.m,v 1.2 2004/05/10 20:26:15 stuver Exp $ 0012 0013 % DETERMINE length of input variables 0014 % DETERMINE mode from length of input variables and their class 0015 0016 mode = []; 0017 0018 % Determine length of input variables 0019 inputLength = length(input); 0020 0021 % Determine mode from length of input variables 0022 if inputLength == 1 0023 mode = 1; % varargin = (inputFileName) 0024 % Read line-by-line from file; angles may not be 'OPTIMAL' 0025 elseif inputLength == 2 0026 temp1 = input{1}; 0027 temp2 = input{2}; 0028 if strcmp(class(temp1), 'double') & strcmp(class(temp2), 'char') 0029 mode = 2; % varargin = (nSim, inputFileName) 0030 % Make nSim draws on the lines of the file; angles may not be 0031 % 'OPTIMAL' 0032 elseif strcmp(class(temp1), 'char') & strcmp(class(temp2), 'char') 0033 mode = 3; % varargin = (inputFileName, detId) 0034 % Read line-by-line from a file; angles may be 'OPTIMAL' 0035 else 0036 error(['makelist -> whatmode: Error in input: varargin = '... 0037 '(nSim, inputFileName) | varargin(inputFileName, detId)']) 0038 end 0039 elseif inputLength == 3 0040 mode = 4; % varargin = (nSim, inputFileName, detId) 0041 % Make nSim draws on the lines of the file; angles may be 'OPTIMAL' 0042 elseif inputLength == 6 0043 mode = 5; % varargin = (nSim, simId, ampl, startSamp, internal, external) 0044 % Variables directly input into makelist; external may not be 'OPTIMAL' 0045 elseif inputLength == 7 0046 mode = 6; 0047 % varargin = (nSim, simId, ampl, startSamp, internal, external, detId) 0048 % Variables directly input into makelist; external may be 'OPTIMAL' 0049 else 0050 error(['makelist -> whatmode: varargin = (inputFileName) | '... 0051 '(nSim, inputFileName) | (inputFileName, detId) | '... 0052 '(nSim, inputFileName, detId) | (nSim, simId, ampl, '... 0053 'startSamp, internal, external) | (nSim, simId, ampl, '... 0054 'startSamp, internal, external, detId)']) 0055 end 0056 0057 return