Using the same example as before, the order of the array elements and the processing results will be
as shown below for an ascending binary search.
Mode=_BIN_ASC
In[0]=abc[0]
In[1]=abc[1]
In[2]=abc[2]
Size=UINT#5
In[3]=abc[3]
In[4]=abc[4]
For a descending binary search, the array elements in the input parameter that is passed to In[] must be
in descending order before this instruction is executed. Then a binary search is performed by executing
this instruction.
Using the same example as before, the order of the array elements and the processing results will be
as shown below for a descending binary search.
Mode=_BIN_DESC
In[0]=abc[0]
In[1]=abc[1]
Size=UINT#5
In[2]=abc[2]
In[3]=abc[3]
In[4]=abc[4]
Additional Information
• In[] can be a member of a higher-level structure.
Example: In[0]=str0.str1[0]
• In[] can be an array with two or more dimensions. If In[] is a two-dimensional array, the element num-
ber in the first dimension of the element that matches the search conditions is assigned to InOut-
Pos[0] and the element number in the second dimension is assigned to InOutPos[1].
NJ-series Instructions Reference Manual (W502)
Key
INT#1234
0000
1234
0000
0000
1234
0000
0000
Member = abc[0].m
2345
0000
0000
3456
Member m
0000
0000
3456
0000
Key
Member=abc[0].m
INT#1234
0000
Member m
3456
0000
0000
3456
0000
0000
2345
0000
0000
1234
0000
0000
1234
0000
2 Instruction Descriptions
Matches
Out = ghi
TRUE
InOutPos[0] = def
UINT#0
UINT#2
Num = jkl
Matches
Out = ghi
TRUE
InOutPos[0] = def
UINT#3
UINT#2
Num = jkl
2
2-485