Creating a sequence with repeating numbers

조회 수: 10 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by