Calculate a value from a table column based on defined intervals give by another table
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I've got a table T with varius columns, 1'st is Time (it's not a timetable necessarly, in thsi specific case it's not, it's time in s but not as timetable).
I've got a 2'nd table T2 with 2 columns which in essence gives the time intervals (start and end lap times in this case, which will match the values in the previus table T as they are extrated from it).
What I'm trying to do is for each set of start/end time intervals in T2 calculate another column (for the given interval) in table T (max for example).
Thanks.
0 Commenti
Risposta accettata
Chunru
il 28 Giu 2022
load("table T");
load("table T2");
head(T)
head(T2)
n = size(T2, 1);
T2_max = zeros(n, 1);
for i=1:size(T2, 1)
T2_max(i) = max(T.AmbientTemp(T.Time>=T2.Start_time(i) & T.Time<T2.End_time(i)));
end
T2.max = T2_max;
T2
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Tables 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!