How to convert a time series data to txt file?

34 visualizaciones (últimos 30 días)
James Pinto
James Pinto el 1 de Nov. de 2022
Respondida: Lei Hou el 18 de Nov. de 2022
I have a time series data saved during simulation. How to convert it to a txt file?

Respuestas (2)

Lei Hou
Lei Hou el 18 de Nov. de 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 el 1 de Nov. de 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')

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by