![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, Germany |
![]() |
GETOPT
Convert a string supplied by the user into a valid scalar or vector
Distinct elements in the string may be
separated by either a comma or a space. The output scalar
or vector can be specified to be either integer or floating
point. A null string is converted to a zero.
option = GETOPT( input, [ type, numopt, COUNT = ])
input - string that was input by user in response to a prompt
Arithmetic operations can be included in the string (see
examples)
type - Either an "I" (integer) or an "F" (floating point) specifying
the datatype of the output vector. Default is floating point
numopt - number of values expected by calling procedure
If less than NUMOPT values are supplied the output
vector will be padded with zeros.
option - scalar or vector containing the numeric conversion of
the fields in the string INPUT. If NUMOPT is not
supplied, the number of elements in OPTION will
equal the number of distinct fields in INPUT.
Count - integer giving the number of values actually returned by
GETOPT. If the input is invalid then COUNT is set to -1
(1) If an input is invalid, Count is set to -1 and the result is set
to 999.
(2) GETOPT uses the execute function to interpret the user string.
Therefore GETOPT itself cannot be called with the EXECUTE
function.
(3) GETOPT has a hard limit of 10 tokens in the input string.
(1) a = getopt( '3.4,5*4 ', 'I' ) yields a = [ 3, 20]
(2) a = getopt( '5/2.', 'F', 5) yields a = [2.5,0.,0.,0.,0.]
(3) a = getopt( '2*3,5,6') yields a = [6.,5.,6.]
written by B. Pfarr, STX, 5/6/87
change value of !ERR W. Landsman STX, 6/30/88
Converted to IDL V5.0 W. Landsman September 1997
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]