HTBasic Help
×
Menu
Index

Matrix Searching

 
The MAT SEARCH statement searches a numeric or string array for certain conditions. The array can be searched for the following:
 
 
The syntax for MAT SEARCH is:
 
MAT SEARCH numeric-array [num-key], rule; return [,start]
MAT SEARCH string-array$ [str-key], rule; return [,start]
 
Where:
num-key = [search-subscripts] [DES]
str-key = [search-subscripts [sub-string]] [DES]
search-subscripts = ( {subscript|*} [,...] )  The ‘*’ must appear once.
rule = [#]LOC ([relational] value) | LOC MAX | LOC MIN | MIN | MAX
relational = < | <= | = | <> | => | >
return = variable-name
start = numeric-expression
value = string-or-numeric-expression
DES = descending search order.
 
The optional start value specifies the starting subscript. If not specified, searching begins with the first element for ascending searches and the last element for DEScending searches. The meaning of the search rule is:
         
Operator
Functionality
LOC
Subscript of first element satisfying operator
#LOC
Count the number of elements satisfying operator
LOC MAX
Subscript of maximum value
LOC MIN
Subscript of minimum value
MAX
Find and return the maximum value
MIN
Find and return the minimum value