repeat an element in a vector

1 Ansicht (letzte 30 Tage)
Sehoon Chang
Sehoon Chang am 27 Mär. 2020
Bearbeitet: Birdman am 27 Mär. 2020
Hi all,
I have one vector and i wish to repeat the first element of the vector once at the very beginning.
For example:
n = [1 2 3 4 5 6 7 8 9]
to
n = [1 1 2 3 4 5 6 7 8 9]
Thank you all.

Akzeptierte Antwort

Birdman
Birdman am 27 Mär. 2020
Bearbeitet: Birdman am 27 Mär. 2020
[n(1) n]
or
[repmat(n(1),1) n]

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by