cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix Search using Array Vector in Prime 3.1

Newbie

Matrix Search using Array Vector in Prime 3.1

Hi,

I was looking for a way of easily searching a data matrix "lookup table" with an array vector to extract a value for use in later calculations. I've seen a post where a single value is used to extract a row of data (I need to extract one row of a matrix) and was wondering if this can be somehow extended to be an vector array to extract a single value "alpha". A nominal array and the proposed data matrix would be similar to that below. I've attached a worksheet if that assists?

Also saw this Build New Matrix by Selecting Specific Columns of Another Matrix maybe this has potential to offer an alternate way of extracting the row then alpha value using this as an approach, cant quiet get my head around the matrix math to see a way through...

Thanks in advance 

Mathcad Vector search.jpg

Message was edited by: Peter Darby

6 REPLIES 6

Re: Matrix Search using Array Vector in Prime 3.1

Maybe you are looking for something like this:

Some rudimentary error handling implemented.

If the last argument is a valid column header, just the value(s) in that column are returned, otherwise the full rows.

Re: Matrix Search using Array Vector in Prime 3.1

How about this?

For clarity, here are the values of LookupVector and MatchValue:

This is shown in Mathcad 15, but I believe everything would be the same in Prime.

You could also turn this series of calculations into a program for ease of use.

Highlighted

Re: Matrix Search using Array Vector in Prime 3.1

Hi Werner,

Many thanks, I'm currently thinking my way through  the method supplied - the matrix math its relatively new so it might take a couple of goes to absorb it. The error handling is good, till now hadn't thought much about that.

Re: Matrix Search using Array Vector in Prime 3.1

Hi Mark,

Thanks, like the concat - it really strips down the logic - I'll try it in prime and see how it goes.

Re: Matrix Search using Array Vector in Prime 3.1

Peter Darby wrote:

Hi Werner,

Many thanks, I'm currently thinking my way through  the method supplied - the matrix math its relatively new so it might take a couple of goes to absorb it. The error handling is good, till now hadn't thought much about that.

I tried to provide a more general utility which works for any header expressions and any type of table values. That way it looks (and is)  more complicate.

Feel free to come back and ask if you experience any confusion.

Re: Matrix Search using Array Vector in Prime 3.1

Hi Werner,

Appreciate the solution you provided - I'm relatively new to the matrix style math in MathCad it seems to have a lot of power. Thinking through your approach really helps to get an understanding and how to apply. So all good - thanks.