From: fckool on
Hi,

i will use this topic to some question about the work I'm doing. (encoding code words of block linear)

1st I have this code to generate an array with all possibility of binary combinations:

for i=1:2^k
m(1,1:k)=dec2bin(0,k);
m(i,1:k)=dec2bin(i-1,k);
end


I want one space between each bit... how can i do it?

Thank you in advance
From: fckool on
it's urgent

Nobody knows?
From: dpb on
fckool wrote:
> it's urgent

Best be getting busy then, I reckon...

> Nobody knows?

Only that I know I don't understand the question.

Give an example of what you mean by a space between each bit...if you
mean you want character representation, something like

sprintf('%c %c %c \n',m')

might suit. If you have something else in mind, I'll have to wait until
the crystal comes back from the shop (again)...

--

From: Walter Roberson on
fckool wrote:

> 1st I have this code to generate an array with all possibility of binary combinations:
>
> for i=1:2^k
> m(1,1:k)=dec2bin(0,k);
> m(i,1:k)=dec2bin(i-1,k);
> end

> I want one space between each bit... how can i do it?

Start by fixing your code. Every iteration of the array, you write over
m(1,1:k) with '0', which is not necessary because when "i" is 1, you store
that same value in the same location.

> It's urgent

m = repmat(' ', 2^k, 2*k-1);
for i = 1 : 2^k
m(i,1:2:2*k-1) = dec2bin(i-1,k);
end
From: fckool on
what is the difference between that code and this one?:

for i = 1:2^k
for j = k:-1:1
if rem(i-1,2^(-j+k+1))>=2^(-j+k)
m1(i,j)=1;
else
m1(i,j)=0;
end
end
end

after this I want do this:

c=mod(m*G,2)
ยด
but it give me an error:
??? Error using ==> mtimes
Inner matrix dimensions must agree.

G it's an array calculated before this.