Speed up for loop
显示 更早的评论
I need to speed up this code, T is a table with 5 columns and approximately 1 million rows. The code is doing what I need but it is pretty slow, it takes 1 hour to do the calculation. Someone can help?
Thanks in advance
rmsA = zeros(height(T),1);
for i=1:height(T)
tf = isbetween(T.VarName1,T.VarName(i)-minutes(2),T.VarName(i)+minutes(2));
xA = T.VarName2(tf);
rmsA(i) = rms((xA-993)/102.04);
end
2 个评论
BALAJI KARTHEEK
2020-4-23
Use parallel computing and parfor loops are available in matlab exactly to solve these type of problems
darova
2020-4-23
Can you attach sample data for experiments?
回答(1 个)
Sulaymon Eshkabilov
2020-4-23
1 个投票
To process date data format is slow. Thus, you can convert all into a serial date number using datenum() that shall speed up the simulation process.
good luck
2 个评论
Emiliano Ascenzi
2020-4-24
Med Aymane Ahajjam
2021-7-28
treat them like you would with normal numbers : .. < .. < ..
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!