Split a vector into 2 oscillating vectors?
显示 更早的评论
I have a .csv file with 1M datapoints, which I've turned into a simple column vector "V". I want to turn it into 2 seperate vectors that take 5k of the data points, back and forth.
So V1 takes 1:5000, 10001:15000, 20,001:25000, etc.
V2 takes 5001:10000, 15001:20000, etc.
Is there an easy way to do this other than typing out 100 sections for each variable?
采纳的回答
更多回答(1 个)
David Hill
2022-1-18
v1=zeros(1,500000);
v2=zeros(1,500000);
for k=1:100
v1((k-1)*5000+1:k*5000)=v((2*(k-1))*5000+1:(2*(k-1)+1)*5000);
v2((k-1)*5000+1:k*5000)=v((2*(k-1)+1)*5000+1:k*10000);
end
类别
在 帮助中心 和 File Exchange 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!