Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

ASCII_TEMPLATE


Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

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.

Syntax

Result = ASCII_TEMPLATE( [Filename] [, BROWSE_LINES=lines] [, CANCEL=variable] [, GROUP=widget_id] )

Return Value

Returns a template defining an ASCII file format.

Arguments

Filename

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.

Keywords

BROWSE_LINES

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.

CANCEL

Set this keyword to a named variable that will contain the byte value 1 if the user clicked the "Cancel" button, or 0 otherwise.

GROUP

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.

The ASCII_TEMPLATE Interface

When the ASCII_TEMPLATE function is invoked, the following dialog is displayed:.

Note
If no filename is supplied in the call to the ASCII_TEMPLATE function, a file selection dialog is displayed prior to the first ASCII_TEMPLATE screen.

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.

Examples

Use the following command to generate a template structure from the file "myFile":

myTemplate = ASCII_TEMPLATE(myFile) 

Version History

Introduced: 5.0

See Also

READ_ASCII, BINARY_TEMPLATE


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]