Duplicating rows in a matrix
Ältere Kommentare anzeigen
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 Kommentar
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)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!