1.下标方式
IDL> array=indgen(8)IDL> print,array 0 1 2 3 4 5 6 7IDL> print,array[3]
IDL> array=indgen(8)IDL> print,array[-1] 7IDL> print,array[-5:-1] 3 4 5 6 7
2.向量方式
IDL> ;读取数组中第一,二,四和第六个元素的代码IDL> array=indgen(8)IDL> indices=[0,1,3,5]IDL> print,array[indices] 0 1 3 5
IDL> ;对30行20列的索引数组取出第6~10列中第12~15行的数据IDL> array=Indgen(20,30)IDL> subarray=array[5:9,11:14]IDL> help,subarraySUBARRAY INT = Array[5, 4]
IDL> ;提取第10行的值IDL> vectoer=array[*,9]IDL> help,vectorVECTOR UNDEFINED =
IDL> ;提取对角线元素IDL> arr=indgen(5,5)IDL> print,arr[indgen(5),indgen(5)] 0 6 12 18 24IDL> print,arr[indgen(5)*(5+1)] 0 6 12 18 24IDL> print,arr[0:(5*5-1):(5+1)] 0 6 12 18 24