1.求大、求小和求余
IDL> arr=indgen(4)
IDL> print,arr
0 1 2 3
IDL> print,arr>3
3 3 3 3
IDL> print,arr<2
0 1 2 2
IDL> print,arr mod 2
0 1 0 1
2.数组与数运算
IDL> ;数组加数
IDL> arr1=indgen(5)
IDL> print,arr1
0 1 2 3 4
IDL> arr2=arr1+6
IDL> print,arr2
6 7 8 9 10
3.数组与数组运算
数组与数组运算,结果中的元素个数与参与运算数组中最少的元素个数一致;多维数组需要转换为一维数组来运算
IDL> arr1=[2,4,6,8]
IDL> arr2=[3,5]
IDL> print,arr1+arr2
5 9
IDL> arr1=[[1,2,3],[4,5,6]]
IDL> arr2=[[1,2],[3,4]]
IDL> print,arr1+arr2
2 4
6 8
4.数组合并
数组与数组合并需要两个数组的行数或者列数相同
IDL> a=indgen(2,5)
IDL> b=indgen(4,5)
IDL> ;行数相同,可直接使用[]
IDL> c=[a,b]
IDL> help,c
C INT = Array[6, 5]
IDL> d=indgen(2,3)
IDL> ;列数相同,需要使用[[],[]]
IDL> e=[[a],[d]]
IDL> help,e
E INT = Array[2, 8]