Averaging data from seconds to three seconds because of different time variables
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2023-8-21
"but do know that I already transferred the timestamps into seconds in my script."
Please provide the original, complete timestamps.
采纳的回答
Torsten
2023-8-21
I'd repeat the data for 3 seconds three times. This does not manipulate your data with interpolation or averaging.
更多回答(2 个)
Star Strider
2023-8-21
编辑:Star Strider
2023-8-21
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')
.
MinJi KANG
2023-8-21
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!