Creating a Vector with specified entries
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
per isakson
2013 年 8 月 8 日
This is better
n = 12;
num = repmat( [1:n], 2, 1 );
num = transpose( num(:) )
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!