You may write your vectors out as an ASCII table, with the data arranged in columns using ASC_WRITE:
ASC_WRITE,'FILENAME',P1,p2,p3,p4,...,p15
FILENAME | The full file name of the output file to be created. If no extension is specified, .TXT is assumed. |
P1 | Vector to write in column 1. |
p2...p15 | Vector(s) to write in columns 2 through 15 (optional; include as many as many as you wish). They must have at least as many elements as P1 (all columns will be the same length as P1 which means that longer vectors will be truncated). |
To read an ASCII table (not necessarily written by ASC_WRITE):
ASC_READ,'FILENAME',P1,p2,...,p15,sl=sl,ll=ll,nel=nel, $
/silent,/dbl
FILENAME | Name of ASCII table file to read. If no extension is included, .TXT is assumed. |
P1 | First column of table. |
p2...p15 | Second through fifteenth columns, as needed. |
sl | (SL) Starting line to read. This allows you to skip column headings. |
ll | (LL) Last line to read. Default is to read the entire file. |
nel | (NEL) Number of lines to read. Default is to read the entire file, up to 2500 lines. |
silent | suppresses standard print statements. |
dbl | keyword to interpret numbers as double precision rather than single precision floating point numbers. |
Both ASC_READ and ASC_WRITE assume the input parameters are all vectors of similar length and contain only numbers (i.e., string arrays are not allowed.) All values read by ASC_READ are returned as floating point vectors unless the "/DBL" keyword is used to read numbers using double precision. Table 3.2 contains examples of both ASC_READ and ASC_WRITE.
Expression | Definition |
---|---|
ASC_WRITE,'data.lis',a,b,c,d,e | Writes five vectors (a, b, c, d, and e) to DATA.LIS in columnar format. |
ASC_READ,'data.lis',a,b,c,/dbl | Read first 3 columns of numbers in DATA.LIS into double precision vectors called a, b, and c. |
ASC_READ,'lc.lis',day,mag,sl=3 | Reads two columns of numbers in LC.LIS into IDL vectors called day and mag, starting at line three of LC.LIS and stopping at the end of the file. |
ASC_READ,'lc2.lis',d2,m2,sl=3,ll=700 | Reads two columns of numbers in LC2.LIS into IDL vectors called d2 and m2, starting at line three and ending with line 700. |
ASC_READ,'lc3.lis',d3,m3,nel=3000 | Reads two columns of numbers in LC3.LIS into IDL vectors called d3 and m3. Up to 3000 numbers per vector will be read. |