How to convert a time series data to txt file?
조회 수: 27 (최근 30일)
이전 댓글 표시
I have a time series data saved during simulation. How to convert it to a txt file?
답변 (2개)
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
댓글 수: 0
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')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!