Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  Libraries  >  ASTROLIB  >  GETOPT

GETOPT

GETOPT

Name


GETOPT

Purpose


Convert a string supplied by the user into a valid scalar or vector

Explanation


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.

Calling Sequence


    option = GETOPT( input, [ type, numopt, COUNT = ])

Inputs


input - string that was input by user in response to a prompt
Arithmetic operations can be included in the string (see
examples)

Optional Inputs


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.

Outputs


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.

Optional Input Keyword


      Count - integer giving the number of values actually returned by
              GETOPT. If the input is invalid then COUNT is set to -1

Notes


(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.

Examples


(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.]

Revison History


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



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us