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!