Creating a sequence with repeating numbers

15 ビュー (過去 30 日間)
Sahil Jain
Sahil Jain 2019 年 7 月 20 日
コメント済み: Stephan 2019 年 7 月 20 日
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)

回答 (1 件)

Stephan
Stephan 2019 年 7 月 20 日
編集済み: Stephan 2019 年 7 月 20 日
b = repelem(1:430,1,2)
or for a column:
b = (repelem(1:430,1,2))'
  2 件のコメント
Sahil Jain
Sahil Jain 2019 年 7 月 20 日
Thanks a lot stephen!
Stephan
Stephan 2019 年 7 月 20 日
Did you notice that you can accept and/or vote for useful answers?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by