How do I combine results of a loop in an array?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to create an array like [1 2 2 3 3 3 4 4 4 4] if n=4 for any n
My first idea was
for m = 1:n
x = [1:m]
x(:)=m
y=[x]
end
But I don't know how I could add all the results to one array.
I am completly new to MATLAB and coding (my second day) so I would be happy if somebody could help me and explain it very easily :)
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!