next up previous contents
Next: Subsets of arrays Up: Arrays Previous: Arrays   Contents

Creating arrays

An array is a numbered group of variables, all of the same type.

Vectors are just 1D arrays

You can define an array by :

IDL> an_array=[3, 5, 6, 2.5, 100, 27.7]

Since we have mixed up floats and integers in this expression; IDL forces all the integers to floats. If you define an array using integers only then IDL will leave them as integers.

IDL> foo=fltarr(100,100); 0.0, 0.0, 0.0, 0.0   ...  0.0
IDL> foo=intarr(100,100); 0,   0,   0,   0, ...     0
IDL> foo=strarr(100,100); '',  '',  '',  '',  ...   ''
IDL> foo=indgen(100)    ; 0,   1,   2,   3,     ... 99
IDL> foo=findgen(100)   ; 0.0, 1.0, 2.0, 3.0, ...   99.0

Look up ``fltarr'', ``indgen'' and any other IDL procedures that you come across and aren't familar with using ``?'' at the IDL prompt.



John Marsham 2009-12-07