I'm looking for something that can repeat a vector without. For exemple, here a is repeated 4 times :
a = [1,2,5];
b = cellfun(a, 4);
b = [1 1 1 1 2 2 2 2 5 5 5 5];
thx

 채택된 답변

Wayne King
Wayne King 2011년 11월 7일

0 개 추천

One way:
a = [1,2,5];
b = reshape(repmat(a,4,1),12,1);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

질문:

2011년 11월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by