Duplicating rows in a matrix
Afficher commentaires plus anciens
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 commentaire
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)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!