IDL

DEFSYSV

DEFSYSV

The DEFSYSV procedure creates a new system variable called Name initialized to Value.

Examples


To create a new, floating-point, scalar system variable called !NEWVAR with an initial value of 2.0, enter:

DEFSYSV, '!NEWVAR', 2.0

You can both define and use a system variable within a single procedure:

PRO foo
   DEFSYSV, '!foo', $
      'Rocky, watch me pull a squirrel out of my hat!'
   ; Print !foo after defining it:
   PRINT, !foo
END

Syntax


DEFSYSV, Name, Value [, Read_Only] [, EXISTS=variable]

Arguments


Name

A scalar string containing the name of the system variable to be created. All system variable names must begin with the character ‘!’.

Value

An expression from which the type, structure, and initial value of the new system variable is taken. Value can be a scalar, array, or structure.

Read_Only

If the Read_Only argument is present and nonzero, the value of the newly-created system variable cannot be changed (i.e., the system variable is read-only, like the !PI system variable). Otherwise, the value of the new system variable can be modified.

Keywords


EXISTS

Set this keyword to a named variable that returns 1 if the system variable specified by Name exists. If this keyword is specified, Value can be omitted. For example, the following commands could be used to check that the system variable XYZ exists:

DEFSYSV, '!XYZ', EXISTS = i
IF i EQ 1 THEN PRINT, '!XYZ exists' ELSE PRINT, $
   '!XYZ does not exist'
 
 

Version History


Original

Introduced

See Also


Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions