Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

Harris Geospatial / Docs Center / Using IDL / Implied Print


Implied Print

Implied Print

If you enter an expression or a variable name at the IDL command prompt, IDL will automatically evaluate the expression and print out the result.

Note: This feature works when entering commands in both the IDL command line and in the IDL Workbench. It also works with the EXECUTE function when you set the CompileFlags argument. However, this feature does not work within IDL routines. To print out expressions and variables within a program you should use the PRINT procedure or EXECUTE.

Tip: You can use the IMPLIED_PRINT keyword to FIX, PRINT, and STRING to format the output using the same rules as implied print.

Printing Expressions and Variables

IDL> 2+2
IDL> a = [0:10:2]
IDL> a
  0       2       4       6       8      10
IDL> a[2:4]
  4       6       8
IDL> sin(a)
  0.00000000      0.90929741     -0.75680250     -0.27941549      0.98935825     -0.54402113
IDL> IDLUnit('1 kg * c^2')
  8.98755E+016 joule

Floating-Point Data

For floating-point data types, unlike the PRINT procedure, Implied Print will automatically use the maximum number of digits of precision. For example:

IDL> print, 1.2345678
IDL> 1.2345678
IDL> print, !dpi
IDL> !dpi


For structures, Implied Print will print out both the field names and the values:

IDL> {field1: "hello, world", field2: {sub1:[1,2,3],sub2:2}}
  FIELD1: "hello, world",
  FIELD2: {
    SUB1:                  [1, 2, 3],
    SUB2:                  2

String Arrays

For one-dimensional string arrays, Implied Print will print out each element on its own line:

IDL> FILE_SEARCH(!DIR, 'query*')
C:\Program Files\Harris\IDLxx\lib\query_ascii.pro
C:\Program Files\Harris\IDLxx\lib\query_bmp.pro
C:\Program Files\Harris\IDLxx\lib\query_csv.pro

List, Hash, and other Data Types

For compound data types such as LIST or HASH, all of the elements are printed using standard JSON notation:

IDL> list(1,2,3)
IDL> HASH("dog", 5, "cat", 6)
  "cat":          6,
  "dog":          5

Overloading Implied Print

For pointers or other object references, only the heap identifier is printed. If you create an object that is a subclass of IDL_Object, you can override the _overloadImpliedPrint method to control the implied print output for your object class.

Multiple Arguments to Implied Print

If you supply several expressions, separated by commas, then each value will be printed on a separate line. For example:

IDL> 2*!DPI, cos(2*!DPI), alog(2*!DPI)

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us