Calculate a value from a table column based on defined intervals give by another table
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Chunru
2022-6-28
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!