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
BALAJI KARTHEEK 2020년 4월 23일
Use parallel computing and parfor loops are available in matlab exactly to solve these type of problems
darova
darova 2020년 4월 23일
Can you attach sample data for experiments?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sulaymon Eshkabilov
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
Emiliano Ascenzi 2020년 4월 24일
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 2021년 7월 28일
treat them like you would with normal numbers : .. < .. < ..

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2020년 4월 23일

댓글:

2021년 7월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by