Creating a sequence with repeating numbers

10 次查看(过去 30 天)
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))'

类别

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