Functions > Vector and Matrix > Other Array Functions > Example: Using the Comparison Option with the Lookup Functions
  
Example: Using the Comparison Option with the Lookup Functions
1. Define two input matrices A and B of equal dimensions
Click to copy this expression
Click to copy this expression
2. Define variable z
Click to copy this expression
3. Use the match function to find elements in matrix A that match z exactly
Click to copy this expression
The function returns the row-column coordinates of the two matched elements in matrix A.
4. Write a program to display the elements found by the match function
Click to copy this expression
5. Use the program to display the exactly matched elements when z=57
Click to copy this expression
6. Use the lookup function to find elements in matrix B that correspond to the matched elements in matrix A
Click to copy this expression
The function returns the matched elements themselves and not their row-column coordinates.
7. Write a program to display the elements found by the lookup function
Click to copy this expression
8. Use the program to display the matched elements of matrix B when z=57
Click to copy this expression
9. Use the two programs to display the elements found by the match and lookup functions using the comparison function f1
Click to copy this expression
This comparison option matches matrix A element values within the r1 range:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
10. Use the two programs to display the elements found by the match and lookup functions using the comparison function f2
Click to copy this expression
This comparison option matches matrix A element values outside the r2 range:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
11. Write a program to convert a matrix to a vector
Click to copy this expression
12. Use the program to convert matrix A to vector V
Click to copy this expression
Click to copy this expression
Click to copy this expression
13. Find the length of the vector of points matched in matrix A
Click to copy this expression
Click to copy this expression
14. Write a program to insert the matched points into a new vector of equal length as V. The program writes -100 in unpopulated positions.
Click to copy this expression
15. Plot the two vectors in a way that hides the -100 points of MV. Use horizontal markers to show the two levels of r2.
Click to copy this expression
Click to copy this expression
Of the twelve elements of vector V (or matrix A), the five matched elements fall outside the specified range of r2.