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.

# Matlab help

Page 1 of 1## 2 Replies - 805 Views - Last Post: 12 July 2010 - 04:29 PM

##
**Replies To:** Matlab help

### #3

## 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.

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.

Page 1 of 1