Duplicating rows in a matrix
古いコメントを表示
Hi there
I have a matrix that i need to make twice as long. i.e i need to double the length of columns. eg i need:
[0 1 0 0]
[0 2 0 0]
to become:
[0 1 0 0]
[0 1 0 0]
[0 2 0 0]
[0 2 0 0]
Thanks
1 件のコメント
Just use REPELEM: https://www.mathworks.com/help/matlab/ref/repelem.html
A = [0,1,0,0;0,2,0,0]
B = repelem(A,2,1)
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!