how to add bits in between the binary data

P=[1 0 1 1 0 1 0 0 1 1] i need to add bits in between 250 bits in between. can some one suggest me a logic how to read each bit and then add 250 same bits and then read next bit add 250 bit my final dat should be like this p1=[1 ....(250 one ) then 0------(250 zeros) then 1.......(250 one).................]

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 6월 18일
편집: Andrei Bobrov 2013년 6월 18일

0 개 추천

out = reshape(ones(251,1)*P(:)',1,[]);
or
out = kron(P(:)',ones(1,251));

댓글 수: 5

Andrei Bobrov
Andrei Bobrov 2013년 6월 18일
comment by pramod kumar
thank you
if PN1=<255x1 double> so i am getting this error ??? Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> repof at 30 out = reshape(ones(250,1)*PN1,1,[]);
Andrei Bobrov
Andrei Bobrov 2013년 6월 18일
See my answer, corrected.
pramod kumar
pramod kumar 2013년 6월 18일
the bit we are adding it is adding in the next colum but the bit should add in between P[1 0 1] we are creating a matrix it should add in between the bits but we are creating < 255x250 double> 1 1 1 1 0 0 0 0 1 1 1 1
Andrei Bobrov
Andrei Bobrov 2013년 6월 18일
편집: Andrei Bobrov 2013년 6월 18일
pramod kumar
pramod kumar 2013년 6월 18일
thank you so much its helped me lot

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Standard File Formats에 대해 자세히 알아보기

질문:

2013년 6월 18일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by