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 commentaires

BALAJI KARTHEEK
BALAJI KARTHEEK le 23 Avr 2020
Use parallel computing and parfor loops are available in matlab exactly to solve these type of problems
darova
darova le 23 Avr 2020
Can you attach sample data for experiments?

Connectez-vous pour commenter.

Réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 23 Avr 2020

1 vote

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 commentaires

Emiliano Ascenzi
Emiliano Ascenzi le 24 Avr 2020
How can I apply isbetween to datenum output? I don't know how much 2 minutes are worth in that form
Med Aymane Ahajjam
Med Aymane Ahajjam le 28 Juil 2021
treat them like you would with normal numbers : .. < .. < ..

Connectez-vous pour commenter.

Catégories

Produits

Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by