How to perform repmat function to repeat rows of a matrix
24 ビュー (過去 30 日間)
表示 古いコメント
A=[1,0,0,0,1;2,0,0,0,2;3,0,0,0,3]
I would like to repeat each row for n times and get output something like this when n is 2:
output=[1,0,0,0,1;1,0,0,0,1;2,0,0,0,2;2,0,0,0,2;3,0,0,0,3;3,0,0,0,3]
0 件のコメント
採用された回答
その他の回答 (5 件)
Bruno Luong
2022 年 8 月 19 日
A=[1,0,0,0,1;2,0,0,0,2;3,0,0,0,3]
reshape(repmat(reshape(A,1,1,[]),2,1,1),[],size(A,2))
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!