MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Felix
on 1 Oct 2013

Hello, I have an image from type double and i want to convert it to binary format with my threshold. Then I try this code:

for i=1:426

for j=1:640

if IM(i,j)>100

bw(i,j)=250

elseif IM(i,j)<100

bw(i,j) =1

end

end

end

it doesn't work.

another way: bw= IM > 100; also doesn't work/ can u help me? thnx

P.S. I can't use this ways only then i work in type - double

*No products are associated with this question.*

Answer by Walter Roberson
on 1 Oct 2013

Accepted answer

images of type double are in the range 0 to 1.

## 0 Comments