Creating a Vector with specified entries
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hey guys,
I'd like to create a vector that goes from 1 to n that looks like this:
[1 1 2 2 3 3 ... n n]
Any ideas?
KD
0 commentaires
Réponse acceptée
per isakson
le 8 Août 2013
This is better
n = 12;
num = repmat( [1:n], 2, 1 );
num = transpose( num(:) )
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!