Skip to main content
1-Visitor
August 12, 2010
Question

Matrix Data Extraction

  • August 12, 2010
  • 2 replies
  • 9871 views

Is there a way to lookup a value in a matrix based on more than one given value? For instance, I want to give a value to match in column 1 and another value to match in column 2 that returns a value from column 3.

Any ideas? I haven't been able to find this topic anywhere, but I can't be the first person to want to do this.

Thanks in advance.

2 replies

1-Visitor
August 12, 2010

I'm not exactly sure what you're trying to get at, do you have an MC spreadsheet for what you want to do?

The first idea that came to my mind was creating a program to scan the rows and colums of the matrix (simple i,j "for" loops) to find input values that you provide and then spit out the third value.

1-Visitor
August 12, 2010

Thank you, Stephen.

The "for" loops may be the best solution. I was hoping there was a shorter way.

I have attached an example of what I am trying to do.

1-Visitor
August 12, 2010

Alright thanks for the sheet, that helped.

I've come up with a solution for the rather small matrix you provided but my program might run into problems if the matrix was a little bit more complicated. In regards to the actual matrix you want to use this program on, does it follow the same form as the example (two size choices for each style)? If not, my solution may need some alterations. Hope this helped!

1-Visitor
August 13, 2010

Just thought I would chip in with my effort (If its right).

More examples = Quicker learning.

I think I have eliminated the use of the for loop.

Mike.

19-Tanzanite
August 13, 2010

Your code assumes that when you match x and Matrix the result (ss) is a two element vector. What if it has three elements? Or five? Try changing the styles to 1,1,1,2, the sizes to 30,30,40,50, and then searching for style=1 and size =40.

1-Visitor
August 13, 2010

Richard Jackson wrote:

Your code assumes that when you match x and Matrix the result (ss) is a two element vector. What if it has three elements? Or five? Try changing the styles to 1,1,1,2, the sizes to 30,30,40,50, and then searching for style=1 and size =40.

Yes agree Richard, my example is only applicable for the Matrix posted.

I'll have a look and try and adapt my effort.

Cheers

Mike