Executing a Simple IDL Program
To show IDL's programming capabilities, the following program example uses the iVolume iTool to display volume data. This example uses Black Hole volume data provided by the University of North Carolina.
- From the IDL Workbench, open a new IDL Editor window by selecting File → New → IDL Source File.
- Type (or copy) the following lines of code into the new Editor window to form a program:
PRO my_ivolume, _EXTRA=_extra ; Set the variable fname to the black hole volume data file fname = FILEPATH('cduskcD1400.sav', SUBDIR=['examples', 'data']) RESTORE, fname ; load a color table and supress the color table message using ; the keyword /SILENT LOADCT, 15, /SILENT ; Return the Red, Green, Blue values from the ; internal color tables ; to the variables r, g, b TVLCT, r, g, b, /GET ; Display the data using the iVolume iTool IVOLUME, density, RGB_TABLE0=[[r],[g],[b]], $ /AUTO_RENDER, /NO_SAVEPROMPT ENDNote
Semicolons (;) in IDL code are indicators of the beginning of comment lines, which explain what the actual code lines are doing and/or help you understand your code (while being ignored by IDL itself).Note
The dollar sign ($) at the end of a line is the IDL continuation character. It allows you to enter long IDL commands as multiple lines.
Saving, Compiling, and Running
To view the program at work, IDL requires a few additional steps:
The resulting iVolume window displays the following image:

Note
If your program encounters an error while executing, be sure to check your code for typographical errors.