# Matlab help

Page 1 of 1

## 2 Replies - 883 Views - Last Post: 12 July 2010 - 04:29 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=180322&amp;s=0b421513a3898e15facd4360b8430aef&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 neosam

Reputation: 0
• Posts: 3
• Joined: 04-July 10

# Matlab help

Posted 05 July 2010 - 04:44 PM

Hello all,
I know this may be a wrong forum, but considering most people who know C would be aware of Matlab as well. I am working on Matlab and need some help. How can I search for a single element from a nx2 matrix? for example:

if A = 12 0
15 1
17 0
19 0
20 1
then how can I find out whether the value of '20' is '1' or '0' ? Is there another way of doing this?
I'm just using this as a flag and cant seem to figure it out.

Thank you.

Is This A Good Question/Topic? 0

## Replies To: Matlab help

• Saucy!

Reputation: 6246
• Posts: 24,014
• Joined: 23-August 08

## Re: Matlab help

Posted 05 July 2010 - 04:48 PM

Moved to Other Languages.

### #3 mufasa

Reputation: 2
• Posts: 44
• Joined: 12-February 10

## Re: Matlab help

Posted 12 July 2010 - 04:29 PM

are you assuming that you would know where the value of 20 is in the matrix first or that you would also have to find where 20 is in the matrix?

a simple loop would be easy enough if you have to find the 20 in the matrix and then use either a vector or a [1,2] matrix to store the row and column where the number is stored. after you have that you can just assign the value in the second column that you want to another variable that you can access later.