Calculate a value from a table column based on defined intervals give by another table
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Chunru
am 28 Jun. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!