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 件のコメント
Dyuman Joshi
2023 年 8 月 21 日
Yes, that because your data does not match in size. See my comment above.
参考
カテゴリ
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!