A := [1,2,1,3,1,4,2,5,4,6]
B := [1,3,3,3,4,4,2,2,6,6]
C := ['x','y','xyz','yyy','z']
*
* Part 1
* 显示元素元组比较。
* 可以比较两个相同长度的元组,也可以将一个元组与单个值进行比较。以下行显示
* a) HDevelop 语言语法([==]、[<] 等)
* b) HALCON 运算符语法(tuple_equal_elem等)
*两种模式返回相同的结果,HDevelop 语言语法返回结果更快。
*
* 等于
AEqualsB_a := A [==] B
tuple_equal_elem (A, B, AEqualsBb_b)
AEquals2_a := A [==] 2
tuple_equal_elem (A, 2, AEquals2_b)
XEqualsC_a := 'x' [==] C
tuple_equal_elem ('x', C, XEqualsC_b)
*
* 不等于
ANotEqualToB_a := A [!=] B
tuple_not_equal_elem (A, B, ANotEqualToB_b)
ANotEqualTo2_a := A [!=] 2
tuple_not_equal_elem (A, 2, ANotEqualTo2_b)
XNotEqualToC_a := 'x' [!=] C
tuple_not_equal_elem ('x', C, XNotEqualToC_b)
*
* 大于
AGreaterThanB_a := A [>] B
tuple_greater_elem (A, B, AGreaterThanB_b)
AGreaterThan2_a := A [>] 2
tuple_greater_elem (A, 2, AGreaterThan2_b)
TwoGreaterThanB_a := 2 [>] B
tuple_greater_elem (2, B, TwoGreaterThanB_b)
*
* 大于等于
AGreaterOrEqualToB_a := A [>=] B
tuple_greater_equal_elem (A, B, AGreaterOrEqualToB_b)
AGreaterOrEqualTo2_a := A [>=] 2
tuple_greater_equal_elem (A, 2, AGreaterOrEqualToB_b)
TwoGreaterOrEqualToB_a := 2 [>=] B
tuple_greater_equal_elem (2, B, TwoGreaterOrEqualToB_b)
*
* 小于
ALessThanB_a := A [<] B
tuple_less_elem (A, B, ALessThanB_b)
ALessThan2_a := A [<] 2
tuple_less_elem (A, 2, ALessThan2_b)
TwoLessThanB_a := 2 [<] B
tuple_less_elem (2, B, TwoLessThanB_b)
*
* 小于等于
ALessOrEqualToB_a := A [<=] B
tuple_less_equal_elem (A, B, ALessOrEqualToB_b)
ALessOrEqualTo2_a := A [<=] 2
tuple_less_equal_elem (A, 2, ALessOrEqualTo2_b)
ThressLessOrEqualToB_a := 3 [<=] B
tuple_less_equal_elem (3, B, ThressLessOrEqualToB_b)
*
* Part 2
*
* 选择满足条件的所有元素
*
* a) 使用 HDevelop 语言函数select_mask
* b) 使用 Halcon 算子select_masktuple_select_mask
*
* 选择大于特定值的所有元素
SelectedElementsOfAGreaterOrEqualToThree_a := select_mask(A,A [>=] 3)
tuple_select_mask (A, A [>=] 3, SelectedElementsOfAGreaterOrEqualToThree_b)
*
*选择一个元组中满足相应元组中特定条件的所有元素:将元素或明智的元组与select_mask进行比较
Filenames := ['abcd.tif','image.jpg','xyz.tif','img00.png']
Extensions := Filenames{strrchr(Filenames,'.') + 1:strlen(Filenames) - 1}
Tiffs_a := select_mask(Filenames,Extensions [==] 'tif')
tuple_select_mask (Filenames, Extensions [==] 'tif', Tiffs_b)
*
dev_open_tool ('variable_view', 'default', 'default', 'default', 'default', [], [], ToolId)