Hi there
What is the difference between ( match) and ( lookup ) function in mathcad prime 11
thanks
Yusra
Solved! Go to Solution.
Match gives the location(s) (index/indices) of the element(s) found, while lookup gives the value(s) of all/an element(s) in (a) location(s) that correspond(s) to the element(s) found.
With matrix:
tells you that the 2 is found at row position 1 in colum 0.
gives you the value in column 1 of that matrix, at the same row where 2 is found in the first column (column 0).
You can also get the value of the element found, by looking up in the same array as where you search...:
but the usefullness of this may be questionable.
As Werner shows, you get multiple results, if the value you look for occurs multiple times in the array.
Success!
Luc
Match gives the location(s) (index/indices) of the element(s) found, while lookup gives the value(s) of all/an element(s) in (a) location(s) that correspond(s) to the element(s) found.
With matrix:
tells you that the 2 is found at row position 1 in colum 0.
gives you the value in column 1 of that matrix, at the same row where 2 is found in the first column (column 0).
You can also get the value of the element found, by looking up in the same array as where you search...:
but the usefullness of this may be questionable.
As Werner shows, you get multiple results, if the value you look for occurs multiple times in the array.
Success!
Luc
Thanks a lot
match(z,A) returns a vector of indices of the position(s) z is found in matrix A
lookup(z,A,B) returns a vector of values from matrix B from the position(s) z is found in A
See the Prime help here: Lookup Functions
Simple example:
EDIT; Oh, too late—Luc has beaten me by one minute. 🙂
