Duplicating rows in a matrix
Mostrar comentarios más antiguos
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 comentario
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)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!