How to perform repmat function to repeat rows of a matrix
34 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Più risposte (5)
Bruno Luong
il 19 Ago 2022
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 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!