Friday, February 28, 2014

IDL array

Here are arrays I'm interested at:
1. Create array with initialization to subscription
B-INDGEN       : byte                         1
U-INDGEN       : unsigned int            2
INDGEN          : int                            2 
UL-INDGEN     : unsigned long int    4 
L-INDGEN        : long int                    4
 
UL64-INDGEN : unsigned 64-bit int   8
L64-INDGEN    : 64-bit int                  8
 
F-INDGEN        : float                          4
D-INDGEN        : double                      8
S-INDGEN         : string                       2.1GB

Eg:
I = INDGEN(5)

2. Create array only
BYTARR   
UINTARR   
INTARR   
 
ULONARR   
LONARR
   
ULON64ARR
LON64ARR
 
FLTARR
DBLARR
STRARR

Eg: Create I, a 3-element by 3-element integer array with each element set to 0 by entering:
I = INTARR(3, 3)

3. MAKE_ARRAY
The MAKE_ARRAY function returns an array of the specified type, dimensions, and initialization. This function enables you to dynamically create an array whose characteristics are not known until run time.
Eg: 
 To create M, a 3-element by 4-element, integer array with each element set to the value 5, enter:
M = MAKE_ARRAY(3, 4, /INTEGER, VALUE = 5)


4. REPLICATE 
   Creates an array of given dimensions, filled with specified value.
Eg: Create D, a 5-element by 5-element array with every element set to the string "IDL" by entering:
D = REPLICATE('IDL', 5, 5)

No comments:

Post a Comment