How to convert a time series data to txt file?

38 vues (au cours des 30 derniers jours)
James Pinto
James Pinto le 1 Nov 2022
I have a time series data saved during simulation. How to convert it to a txt file?
  1 commentaire
KSSV
KSSV le 1 Nov 2022
How is your data? Is it saved in other format?

Connectez-vous pour commenter.

Réponses (2)

Lei Hou
Lei Hou le 18 Nov 2022
Hi James,
You can use timeseries2timetable to convert your timeseries to a timetable. Then use writetimetable to write your data to a txt file.
Thanks,
Lei

Maik
Maik le 1 Nov 2022
%% Time Series Data in to Text File
timeSeriesVector = randi([1 10],30,1);
txtFileCreate = fopen('timeSeriesVector.txt','wt');
%Comma Separated Values
fprintf(fid,'%d,',timeSeriesVector);
% Print in Separate Rows
fprintf(fid,'%d\n',timeSeriesVector);
fclose(fid);
%% Time Series Matrix File to Data File
timeSeriesArray= randi([1 10],30,30);
writematrix(timeSeriesArray,'timeSeriesArray.txt')

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by