|
Using IDL: Importing and Writing Data into Variables |
|
To import a binary file into IDL using a macro, complete the following steps:
surface.dat from the examples/data directory in your IDL installation directory. Click Open.
Binary files opened with the Import Binary File macro are stored in structure variables which are named filename_BINARY where filename is the name of the file you opened without the extension.
| Note IDL variables must begin with a letter, and may contain only letters, digits, the underscore character, or the dollar sign. If the first character of filename is not a letter, the prefix "var" is added to the variable name. Any spaces within filename are converted to underscores. Any other illegal characters within filename are removed. |
So, the file we just opened (surface.dat) is now in the structure variable named SURFACE_BINARY. The variable is a structure, and contains elements that are the field names defined in the Binary Template dialog. In this case the single field is named marbells. The structure can be viewed in the Variable Watch Window.
![]() |
Access data from the structure variable using the following syntax:
variable_name.element_name
For example, display the surface by entering:
ISURFACE, SURFACE_BINARY.marbells
IDL Online Help (March 06, 2007)