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.

1 件のコメント

Awesomer
Awesomer 2017 年 11 月 5 日
Thank you so much for answer.

サインインしてコメントする。

カテゴリ

タグ

質問済み:

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