-2

I tried to convert an image to binary form using dec2bin() function in MATLAB. here i got an error showing

'Operands to the || and && operators must be convertible to logical scalar values'.

Error in ==> dec2bin at 31 if any(d < 0) || any(~isfinite(d))

Yamaneko
  • 3,433
  • 2
  • 38
  • 57
Rathan
  • 43
  • 7
  • 1
    Maybe your question is related to this other: http://stackoverflow.com/questions/9172789/how-to-solve-operands-to-logical-scalar-matlab – Yamaneko Sep 26 '12 at 00:32

1 Answers1

1

You might want to use the function im2bw which is made for converting to binary images:

http://www.mathworks.fr/help/images/ref/im2bw.html;jsessionid=ffd69b1a6ad7ebef254b7cb71ac6

Oli
  • 15,935
  • 7
  • 50
  • 66