Azzera filtri
Azzera filtri

Matching columns of timetables

2 visualizzazioni (ultimi 30 giorni)
vidit kedia
vidit kedia il 29 Gen 2021
Risposto: dpb il 29 Gen 2021
I have two time tables: date_tt (261 X 7) and energy_tt (25056 X 5). The rowtimes in energy_tt is the date and time at 15 minute intervals for the year 2019 (excluding the weekends). The row times in date_tt each date of 2019(again excluding weekends). The fourth column in date_tt is of datetime format with the date of the corresponding rowtime and an assigned time.
Now, I have to match the datetime in energy_tt rowtimes with the datetimes in date_tt 4th column. For this i wrote the following code.
for i = 1:height(energy_tt)
for j = 1:height(date_tt)
if energy_tt.Properties.RowTimes(i) == date_tt.Start_time_1(j)
energy_tt.Power(i) = 11;
end
end
end
But given the large number of rows in both the timetables, the code takes a lot of time to run. Kindly suggest a way to optimize this code.

Risposta accettata

dpb
dpb il 29 Gen 2021
ix=ismember(energy_tt.RowTimes,date_tt.Start_time_1);
energy_tt.Power(ix) = 11;
Also see the synchronize function

Più risposte (0)

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by