Export time series data as csv

조회 수: 40 (최근 30일)
Ross Thompson
Ross Thompson 2021년 5월 4일
댓글: Ross Thompson 2021년 5월 4일
I have a csv with 2 columns in, the first is the timestamp (2021-02-27 12:00:00), and the 2nd is heartrates. Ive calculated a moving average of the heartrate coulmn and wish to export the moving average values along with the timestamps as a new csv. Everything uve tried doesnt seem to work so any help would be much apprecieted.

답변 (2개)

EmirBeg
EmirBeg 2021년 5월 4일
data = [timestamps movavgval]; %or however your arrays are called
writematrix(data,'data.csv');
  댓글 수: 2
Ross Thompson
Ross Thompson 2021년 5월 4일
I get the following error when i tried this
Error using datetime/horzcat (line 1387)
All inputs must be datetimes or date/time character vectors or date/time strings.
Error in movingaverage (line 11)
data1 = [data.Timestamp timeseriesmoving_average]
Ross Thompson
Ross Thompson 2021년 5월 4일
data = readtable('2021-02-01.csv');
timeseriesmoving_average = movmean(data.HeartRate, minutes(20), 'SamplePoints', data.Timestamp);
data1 = [data.Timestamp, timeseriesmoving_average]
writematrix(data1,'data.csv');
Heres the code i used

댓글을 달려면 로그인하십시오.


KSSV
KSSV 2021년 5월 4일
Read about writetable

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by