Creating a sequence with repeating numbers

10 vues (au cours des 30 derniers jours)
Sahil Jain
Sahil Jain le 20 Juil 2019
Commenté : Stephan le 20 Juil 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)

Réponses (1)

Stephan
Stephan le 20 Juil 2019
Modifié(e) : Stephan le 20 Juil 2019
b = repelem(1:430,1,2)
or for a column:
b = (repelem(1:430,1,2))'
  2 commentaires
Sahil Jain
Sahil Jain le 20 Juil 2019
Thanks a lot stephen!
Stephan
Stephan le 20 Juil 2019
Did you notice that you can accept and/or vote for useful answers?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by