Creating a sequence with repeating numbers

15 views (last 30 days)
Sahil Jain
Sahil Jain on 20 Jul 2019
Commented: Stephan on 20 Jul 2019
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)

Answers (1)

Stephan
Stephan on 20 Jul 2019
Edited: Stephan on 20 Jul 2019
b = repelem(1:430,1,2)
or for a column:
b = (repelem(1:430,1,2))'
  2 Comments
Stephan
Stephan on 20 Jul 2019
Did you notice that you can accept and/or vote for useful answers?

Sign in to comment.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!