フィルターのクリア

How do I repeat elements individually in a row

1 回表示 (過去 30 日間)
Josh
Josh 2014 年 3 月 4 日
コメント済み: Josh 2014 年 3 月 4 日
I have a matrix of several thousand rows each of which is 16 bits representing an integer. In order to simulate 3,1 error correction I have to replicate each bit 3 times. I am currently doing this using for loops, I have read about kron and repmat and they seem that they would be more efficient for this but I can't figure out how to use them properly to do it.
Small example
1111 becomes 111 111 111 111 (without spaces they are there for clarification)
0000 becomes 000 000 000 000
1010 becomes 111 000 111 000

採用された回答

Dina Irofti
Dina Irofti 2014 年 3 月 4 日
a = [1 0 1 0] % or a = [1 1 1 1] or a = [0 0 0 0]
b = [1 1 1]
kron(a,b)
  1 件のコメント
Josh
Josh 2014 年 3 月 4 日
That does the trick rather nicely. Thank you for the very quick answer.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by