Repeat matrix element of a given matrix
Mostrar comentarios más antiguos
my matrix is x=[2 5 3 6 1]
I want it to make it as y=[2 2 2 2 5 5 5 5 3 3 3 3 6 6 6 6 1 1 1 1]
which function does it?
1 comentario
Jan
el 11 de Mzo. de 2015
This topic is discussed such frequently, that I miss it in the FAQ.
Respuesta aceptada
Más respuestas (3)
Another quick one-liner:
reshape(ones(4,1)*x,1,[])
Andrei Bobrov
el 11 de Mzo. de 2015
x = [2 5 3 6 1];
y = x(ceil((1:4*numel(x))/4));
3 comentarios
Nikhil Chourasia
el 11 de Mzo. de 2015
Nikhil Chourasia
el 13 de Mzo. de 2015
Andrei Bobrov
el 13 de Mzo. de 2015
x = unique(y);
Categorías
Más información sobre Calculus 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!