H = [1 1; 1 2; 2 -1; 2 0; -1 2; -2 1; -1 -1; -2 -2;]';
I need to threshold each value such that
H(I,j) = 0 if H(I,j) > =1,
else H(I,j) = 1 if H(I,j) <=0
I applied this code
a = H(1,1)
a(a<=0) = 1
a(a>=1) = 0
But this means that the already affected value in the first step may get changed again. What is the correct way of thresholding? The above code is giving incorrect answers. I should be getting
a = [0 0; 0 0; 0 1; 0 1; 1 0; 1 0; 1 1; 1 1]
Please help
EDIT
Based upon the answer now I am getting
0 0
0 0
1.0000 0.3443
0.8138 0.9919
0 0.7993
0.1386 1.0000
1.0000 1.0000
1.0000 1.0000
As can be seen, rows 3-6 are all incorrect. Please help