get interpolated values from timetable
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ryan
el 1 de Feb. de 2024
I have a timetable (using readtimetable from a csv).
datetime, tempA, tempB
1/1/1990 9:00, 36, 12
1/1/1990 10:00, 28, 24
...
I have a time that I want to extract a interpolated temp. Lets say 1/1/1990 9:32. How can I get tempA and tempB as linearly interpolated given a random time. I dont necessarily want to resample all the data which I see you can do.
0 comentarios
Respuesta aceptada
Stephen23
el 1 de Feb. de 2024
Editada: Stephen23
el 1 de Feb. de 2024
INTERP1 accepts DATETIME objects:
dt = datetime(1990,1,1,[9;10],0,0);
A = [36;28];
B = [12;24];
T = table(dt,A,B)
newT = datetime(1990,1,1,9,32,0)
newA = interp1(T.dt,T.A,newT)
newB = interp1(T.dt,T.B,newT)
You could even combine them into one INTERP1 call:
newAB = interp1(T.dt,T{:,["A","B"]},newT)
Or you could use a TIMETABLE and RETIME:
TT = table2timetable(T)
newTT = retime(TT,newT,'linear')
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Multirate Signal Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!