Could someone tell me how to search for all the zero's in a martix and then replace it wirh NaN ?
say:
x = [1 1 1 0; 1 1 0 0; 0 0 0 0; 1 1 0 1; 0 0 1 1]
x =
1 1 1 0
1 1 0 0
0 0 0 0
1 1 0 1
0 0 1 1
I can find the 0 using
find(x == 0)
ans =
3
5
8
10
12
13
14
16
17
18
But how do I replace these values ?
I'm sorry if similar questions have been answered, but I could only find examples of replacing NaNs with numbers or integers.
|
|
0
|
|
|
|
Reply
|
Priom
|
7/30/2010 10:47:06 PM |
|
ImageAnalyst wrote:
> x(x==0)=nan
x(~x)=nan; % :p
|
|
0
|
|
|
|
Reply
|
Walter
|
7/30/2010 10:55:48 PM
|
|