Split a vector into 2 oscillating vectors?
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (1)
David Hill
am 18 Jan. 2022
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
Kategorien
Mehr zu Assembly finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!