The ASCII_TEMPLATE function presents a graphical user interface (GUI) which generates a template defining an ASCII file format. Templates are IDL structure variables that may be used when reading ASCII files with the READ_ASCII routine. See READ_ASCII for details on reading ASCII files.
This routine is written in the IDL language. Its source code can be found in the file ascii_template.pro in the lib subdirectory of the IDL distribution.
Result = ASCII_TEMPLATE( [Filename] [, BROWSE_LINES=lines] [, CANCEL=variable] [, GROUP=widget_id] )
Returns a template defining an ASCII file format.
A string containing the name of a file to base the template on. If Filename is not specified, a dialog allows you to choose a file.
Set this keyword equal to the number of lines that will be read in at a time when the "Browse" button is selected. The default is 50 lines.
Set this keyword to a named variable that will contain the byte value 1 if the user clicked the "Cancel" button, or 0 otherwise.
The widget ID of an existing widget that serves as "group leader" for the ASCII_TEMPLATE graphical user interface. When a group leader is killed, for any reason, all widgets in the group are also destroyed.
When the ASCII_TEMPLATE function is invoked, the following dialog is displayed:.
| Note |
The first page displays a representative sample of lines from the data file with their numbers on the left. Select the field type that best describes the data. Click the Next button on the bottom-right corner of the screen to move to the next page.
The second page displays the number of fields per line which is listed as three and the white space is selected for the data delimiter. Click the Next button on the bottom right corner of the screen to move to the next page.
The third page displays the columns in the data set which can be named and their data type specified. Name the fields by typing in the name text at the upper right of the form. Click the Finish button on the bottom-right corner of the screen.
Use the following command to generate a template structure from the file "myFile":
myTemplate = ASCII_TEMPLATE(myFile)
Introduced: 5.0