Averaging data from seconds to three seconds because of different time variables
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Ilse Frans
el 21 de Ag. de 2023
Editada: Ilse Frans
el 30 de Ag. de 2023
I have measured data with two different devices.
One device (Garmin device)measured data every second for about 20 minutes, so I have data with a 1207x1 format.
The other device (Cosmed device) measured data every 3 seconds (so 1, 4, 7, 10, etc.) also for about 20 minutes, so this results in a 470x1 format.
I want to compare variables measured from these devices, but for a reliable analysis I have to have the same time dimension (either per 1 or 3 seconds).
The most simple option would be per 3 seconds, but in order to do that I have to ''average'' the data from the Garmin for every 3 seconds.
What is the simplest way to achieve this?
Thanks in advance!
8 comentarios
Stephen23
el 21 de Ag. de 2023
"but do know that I already transferred the timestamps into seconds in my script."
Please provide the original, complete timestamps.
Respuesta aceptada
Torsten
el 21 de Ag. de 2023
I'd repeat the data for 3 seconds three times. This does not manipulate your data with interpolation or averaging.
Más respuestas (2)
Star Strider
el 21 de Ag. de 2023
Editada: Star Strider
el 21 de Ag. de 2023
I am not certain that it is possible, however if it is, some combination of retime and synchronize could work.
EDIT — (21 Aug 2023 at 12:41)
Please provide the complete ‘garmin_timestamp’ with all the fields. Only having the seconds values is not going to work.
The ‘cosmed’ times appear to have only the minutes and seconds. It would help to have the hours aa well, if that is possible. (We can assume for the time being that they are the same days.)
type('garmin_cosmed_marc.m')
Uz = unzip('garmin_cosmed.zip');
LDG = load(Uz{1});
garmin_alldata = LDG.garmin_alldata
LDC = load(Uz{2});
cosmed_alldata = LDC.cosmed_alldata(4:end,10:end);
cosmed_alldata.t = datetime(cosmed_alldata.t,'InputFormat','mm:ss', 'Format','mm:ss')
.
1 comentario
MinJi KANG
el 21 de Ag. de 2023
Let the Garmin device's data as x
for i=1:3:length(x)
avg = mean(x(i:i+2))
end
If you do that, you can get avg(470x1 format) data.
Hope you can solve it.
2 comentarios
Dyuman Joshi
el 21 de Ag. de 2023
Yes, that because your data does not match in size. See my comment above.
Ver también
Categorías
Más información sobre Descriptive Statistics 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!