Creating a sequence with repeating numbers

I want to create a sequence as follows: The sequence should have a single column with each number repeated twice (1,1,2,2,3,3,4,4,....430,430)

Risposte (1)

Stephan
Stephan il 20 Lug 2019
Modificato: Stephan il 20 Lug 2019
b = repelem(1:430,1,2)
or for a column:
b = (repelem(1:430,1,2))'

2 Commenti

Thanks a lot stephen!
Did you notice that you can accept and/or vote for useful answers?

Accedi per commentare.

Categorie

Tag

Richiesto:

il 20 Lug 2019

Commentato:

il 20 Lug 2019

Community Treasure Hunt

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

Start Hunting!

Translated by