How do I split a vector into parts using indexes?
조회 수: 48 (최근 30일)
이전 댓글 표시
I have a vector, say
x = 1:100;
and I have a vector that is indexes within the range of the size of x, say,
y=[10,40,60];
I want to cut up x so that I get the three vectors:
x1 = x(1:y(1));
x2 = (y(1)+1:y(2));
x3 = (y(2)+1:y(3));
I tried to use a loop but there is indexing errors due to Matlab indexing starting at 1.
Help appreciated.
댓글 수: 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!