repeat an element in a vector

2 次查看(过去 30 天)
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.

采纳的回答

Birdman
Birdman 2020-3-27
编辑:Birdman 2020-3-27
[n(1) n]
or
[repmat(n(1),1) n]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by