Repeat matrix element of a given matrix
Ältere Kommentare anzeigen
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 Kommentar
Jan
am 11 Mär. 2015
This topic is discussed such frequently, that I miss it in the FAQ.
Akzeptierte Antwort
Weitere Antworten (3)
Another quick one-liner:
reshape(ones(4,1)*x,1,[])
Andrei Bobrov
am 11 Mär. 2015
x = [2 5 3 6 1];
y = x(ceil((1:4*numel(x))/4));
3 Kommentare
Nikhil Chourasia
am 11 Mär. 2015
Nikhil Chourasia
am 13 Mär. 2015
Andrei Bobrov
am 13 Mär. 2015
x = unique(y);
Kategorien
Mehr zu Calculus 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!