is there a function in matlab that creates a binary repetition coder ?

조회 수: 11 (최근 30일)
for example when i enter a sequence 0010110 ;when n=3
the result will be 000000111000111111000

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 25일
편집: Azzi Abdelmalek 2012년 12월 25일
s='0010110'
out=repmat(s,3,1)
out=out(:)'
%or
s=[0 0 1 0 1 1 0];
out=reshape(repmat(s,3,1),1,[])
  댓글 수: 7
mary
mary 2012년 12월 25일
okey it worked .. thanx alot :)

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

추가 답변 (1개)

Nasser M. Abbasi
Nasser M. Abbasi 2012년 12월 25일
You did not say what is the class of 0010110, so I assume cell array.
r = {'0' '0' '1' '0' '1' '1' '0'};
n = 3;
reshape(repmat(r,n,1),1,n*numel(r))'
ans =
'0'
'0'
'0'
'0'
'0'
'0'
'1'
'1'
'1'
'0'
'0'
'0'
'1'
'1'
'1'
'1'
'1'
'1'
'0'
'0'
'0'
This is a cell. Now you can do with it any conversion you want.
--Nasser
  댓글 수: 2
mary
mary 2012년 12월 25일
it is a 1 by n matrix .. by the way can you help me with generating such an array of zeros and ones?? thanx alot
mary
mary 2012년 12월 25일
i mean such a matrix of 1 by n dimensions?

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

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by