Optimising or removing For loop : Help required to optimise script to save memory
古いコメントを表示
Can anyone please suggest if there is a way to optimise the following for loop: I have a time vector which is incrementing every 1024 samples. Increment value is not always consistent, but is close to 0.25s (I need the real values) The time stamp for each sample should have really been updated, but it was never done. I need to now update the time stamps on each of my time samples making sure I use the real values to constrain the time-stamps.
The time matrix I am reading is HUGE, so any optimisation will save me runtime+memory. I only have a 4Gb RAM and a standard 3.1GHz PC.
My bulky script
t1=datevec(DASI.time(1));
time=[];
for i=1:length(A)
t2=datevec(DASI.time(A(i)+1));
du=etime(t2,t1);
dt=du/A(1);
s0=t1(1,6);
y0=t1(1,1);
m0=t1(1,2);
d0=t1(1,3);
h0=t1(1,4);
min0=t1(1,5);
temp_time=datenum(y0,m0,d0,h0,min0,(s0:dt:s0+du-dt))';
time=[time;temp_time];
t1=t2;
end
Hope someone can help me optimise this bit of code.
Thanks
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Language Fundamentals についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!