idlastro / Miscellaneous (Non-Astronomy) Procedures: RDFLOAT

[Source code]

NAME
RDFLOAT
PURPOSE
Quickly read a numeric ASCII data file into IDL floating/double vectors.
EXPLANATION
Columns of data may be separated by tabs or spaces.      This 
program is fast but is restricted to data files where all columns can 
be read as floating point (or all double precision).   
Use READCOL if  greater flexibility is desired.   Use READFMT to read a 
fixed-format ASCII file.   Use FORPRINT to print columns of data.
CALLING SEQUENCE
RDFLOAT, name, v1, [ v2, v3, v4, v5, ...  v19] 
                   COLUMNS, /DOUBLE, SKIPLINE = , NUMLINE = ]
INPUTS
NAME - Name of ASCII data file, scalar string. 
OPTIONAL INPUT KEYWORDS
COLUMNS - Numeric scalar or vector specifying which columns in the file
         to read.    For example, if COLUMNS = [3,7,11] then the first
         output variable (v1) would contain column 3, the second would
         contain column 7 and the third would contain column 11.   If
         the number of elements in the COLUMNS vector is less than the
         number of output parameters, then consecutive columns are 
         implied.    For example, if 3 output parameters are supplied
         (v1,v2,v3) and COLUMNS = 3, then columns 3,4, and 5 will be
         read.   
SKIPLINE - Integer scalar specifying number of lines to skip at the top
        of file before reading.   Default is to start at the first line.
NUMLINE - Integer scalar specifying number of lines in the file to read.  
       Default is to read the entire file
/DOUBLE - If this keyword is set, then all variables are read in as
        double precision.
/SILENT - Set this keyword to suppress any informative messages
OUTPUTS
V1,V2,V3,...V19 - IDL vectors to contain columns of data.
         Up to 19 columns may be read.  All output vectors are of type
         float, unless the /DOUBLE keyword is set, 
EXAMPLES
Each row in a file 'position.dat' contains a star number and 6 columns
of data giving an RA and Dec in sexagesimal format.   Read into IDL 
variables.     
 IDL> rdfloat,'position.dat',ID,hr,min,sec,deg,dmin,dsec  
 All output vectors will be floating point.    To only read the 
 declination vectors (Deg,dmin,dsec)
 IDL> rdfloat,'position.dat',deg,dmin,dsec,col=4
RESTRICTIONS
(1) All rows in the file must be formatted identically (except for 
    those skipped by SKIPLINE).    RDFLOAT reads the first line of 
    the data (after SKIPLINE) to determine the number of columns of 
    data.
(2) Cannot be used to read strings
PROCEDURES USED
None.
REVISION HISTORY
Written         W. Landsman                 September 1995
Call NUMLINES() function                    February 1996
Read up to 19 columns                       August 1997
Allow to skip more than 32767 lines  W. Landsman  June 2001
Added /SILENT keyword   W. Landsman         March 2002
Added COLUMNS keyword, use STRSPLIT    W. Landsman May 2002
Use SKIP_LUN if V5.6 or later          W. Landsman Nov 2002
V5.6 version, use FILE_LINES()         W. Landsman Dec 2002
          Use Catch rather than On_ERROR,2      W. Landsman Jan 2018