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!