Azzera filtri
Azzera filtri

Export time series data as csv

96 visualizzazioni (ultimi 30 giorni)
Ross Thompson
Ross Thompson il 4 Mag 2021
Commentato: Ross Thompson il 4 Mag 2021
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.

Risposte (2)

EmirBeg
EmirBeg il 4 Mag 2021
data = [timestamps movavgval]; %or however your arrays are called
writematrix(data,'data.csv');
  2 Commenti
Ross Thompson
Ross Thompson il 4 Mag 2021
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 il 4 Mag 2021
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

Accedi per commentare.


KSSV
KSSV il 4 Mag 2021
Read about writetable

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by