Excuse me everyone, I want ask that how to repeating the matrix element like this example :
Example: y = [1; 2; 3; 4] and then I want the output like this (for example until N=7) :
Thanks

댓글 수: 2

Matt J
Matt J 2018년 9월 23일
편집: Matt J 2018년 9월 23일
Why is there a '5' in x but not in y?
Dirga Eka Putra L
Dirga Eka Putra L 2018년 9월 23일
편집: Dirga Eka Putra L 2018년 9월 23일
Sorry Sir, I have a typo, I Fixed (for Example N=7) :
Thanks

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

 채택된 답변

Matt J
Matt J 2018년 9월 23일

1 개 추천

m=numel(y);
y(mod(0:N-1,m)+1)

추가 답변 (1개)

dpb
dpb 2018년 9월 23일

2 개 추천

Just one of many possible ways...
L=length(y);
N=7;
x=repmat(y,ceil(N/L),1);
x=x(1:N);

카테고리

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

태그

질문:

2018년 9월 23일

댓글:

2018년 9월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by