halcon 数组专集

1.逻辑运算

1 t1:=[true,true,false,false]
2 t2:=[true,false,false,false]
3 *(1)与运算
4 tuple_and (t1, t2, result_and)   
5 *(2)或运算
6 tuple_or (t1, t2, result_or)    
7 *(3)非运算
8 tuple_not (t1, result_not)   

  

 

 

 

 

 

 

 2.算术运术

 1 t1:=[10,20,30,15,25]
 2 t2:=[5,25,35,45,-20]
 3 *(1)求最大值
 4 tuple_max (t1, Max)    
 5 *(2)比较两个数组的对应元素,取每个大值放于结果中
 6 tuple_max2 (t1, t2, Max2)
 7 *(3)求最小值
 8 tuple_min (t1, Min)  
 9 *(4)比较两个数组的对应元素,取每个小值放于结果中
10 tuple_min2 (t1, t2, Min2)         
11 *(5)求和
12 tuple_sum (t1, Sum) 
13 * (6)求平均值
14 tuple_mean (t1, Mean)   
15 * (7)求绝对值
16 tuple_abs (t2, Abs)   
17 * (8)求偏差值
18 tuple_deviation (t1, Deviation)   
19 * (9)求相反数
20 tuple_neg (t1, Neg)                
21 * (10)求中值
22 tuple_median (t1, Median)        
23 * (11)角度转弧度值
24 tuple_rad (180, Rad)         

 

3.四则运算

 1 t1:=[10,20,30,15,25]
 2 t2:=[5,25,35,45,-20]
 3 * 加
 4 tuple_add (t1, t2,  Sum)  
 5 * 减
 6 tuple_sub (t1, t2, Diff)
 7 * 乘
 8 tuple_mult (t1, t2, Prod)
 9 * 除(注意商的数据类型)
10 tuple_div (t1, t2, Quot)

 

 

 4.排序

1 t1:=[10,25.2,30,15,25]
2 * (1)升序
3 tuple_sort (t1, Sorted)
4 * (2)反转
5 tuple_inverse (Sorted, Inverted)
6 * (3) 升序排序后返回的数组元素是排好序的元素原来的下标
7 tuple_sort_index (t1, Indices)

 

 

 5.其它

 1 t1:=[10,20,30,40,30,50]
 2 t2:=[10,20,30,40,30,50]
 3 * (1)在数组1中寻找数组2,如果有返回第一个元素对应的下标,否则返回-1
 4 tuple_find (t1, t2, Indices)
 5 * (2)在数据中查找元素第一次出现的位置
 6 tuple_find_first (t1, 30, Index1)
 7 * (3)在数据中查找元素最后出现的位置
 8 tuple_find_last (t1, 30, Index2)
 9 * (4)获取数组长度
10 tuple_length (t1, Length)
11 * (5) 截取组成新数组
12 tuple_select_range (t1, 1, 3, Selected)
13 * (6) 比较两个数组是否相等(相等结果为1,不等结果为0)
14 tuple_equal (t1, t2, Equal)
15 * (7)并集(并将结果进行了升序排列)
16 tuple_union (t1, t2, Union)
17 * (8)交集(并将结果进行了升序排列)
18 tuple_intersection (t1, t2, Intersection)
19 * (9)差集(并将结果进行了升序排列)
20 tuple_difference (t1, t2, Difference)

 

posted @ 2021-03-12 14:05  KP16888  阅读(1270)  评论(0)    收藏  举报