lets say i have an array x=[1 0 1] how can i sample every bit 10 times. output will be 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1

 채택된 답변

Star Strider
Star Strider 2017년 11월 5일
편집: Star Strider 2017년 11월 5일

0 개 추천

Try this:
x=[1 0 1];
N = 10;
Output = reshape(repmat(x(:)', N, 1), 1, [])

댓글 수: 2

Awesomer
Awesomer 2017년 11월 5일
It works! Thank you so much.
Star Strider
Star Strider 2017년 11월 5일
As always, my pleasure!

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

추가 답변 (1개)

Steven Lord
Steven Lord 2017년 11월 5일

0 개 추천

Use the repelem function.

카테고리

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

태그

질문:

2017년 11월 5일

댓글:

2017년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by