Split a vector into 2 oscillating vectors?
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (1)
David Hill
il 18 Gen 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
Categorie
Scopri di più su Assembly in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!