How to convert a time series data to txt file?

27 ビュー (過去 30 日間)
James Pinto
James Pinto 2022 年 11 月 1 日
回答済み: Lei Hou 2022 年 11 月 18 日
I have a time series data saved during simulation. How to convert it to a txt file?
  1 件のコメント
KSSV
KSSV 2022 年 11 月 1 日
How is your data? Is it saved in other format?

サインインしてコメントする。

回答 (2 件)

Lei Hou
Lei Hou 2022 年 11 月 18 日
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 2022 年 11 月 1 日
%% 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')

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by