Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Matlab Prob: Replace any values in matrix

Status
Not open for further replies.

naddie

Civil/Environmental
Jul 25, 2010
2
0
0
AU
Hi all,

I am really new with matlab and would like some helps with matlab.. Here is the problem:

Say if i have a 256 by 256 matrix. I would like to replace any values that are 'greater' or 'equal' to 10 with 'one' and name the rest as 'zero' i.e. (values <10).. How can I do it??

For example, 256 by 256 matrix,

2 3 6 15 24 32 1 7 39 10....

1 5 7 11 19 10 20 28 9......

10 24 6 29 10 25 32 10.....

.........................

............................

and I want it to look like the one shown below (256 by 256 matrix),

0 0 0 1 1 1 0 0 1 1 ............

0 0 0 1 1 1 1 1 0 ..............

1 1 0 1 1 1 1 1 ...............

.....................

....................

Thank you so much in advance with all your time... :)


 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top