Date: Mar 6, 2013 9:15 AM
Author: Steven Lord
Subject: Re: commBCHEncoder/commBCHDecoder

"Timothy Koh" <> wrote in message
> hi
> i am facing some problem encoding a 480x640 image with commBCHEncoder.
> i manage to convert the image into matrix using imread where i will get
> <480x640x3 unit8>.
> Next i use B=(A(:,:,1)); where A is my image is matrix.
> C=reshape(B,[],1);
> D=dec2bin(C);

"str = dec2bin(d) binary representation of d as a string."

If you want D to contain the numbers 0 and 1 instead of the characters '0'
and '1' then use either:

D = D - '0';
% or
D = (D == '1');

Since the error message indicates that either numeric or logical variables
are acceptable, either of these should work.


Steve Lord
To contact Technical Support use the Contact Us link on