Ploting data from .txt file
显示 更早的评论
I gathered some data in this format
17:51:10 927.00
17:51:15 950.00
17:51:21 827.00
17:51:27 999.00
17:51:33 1088.00
17:51:38 1094.00
17:51:44 1109.00
as you can see first part is time and second is the data.
I extracted data using this code
fid = fopen('.\test.txt','r');
cac = textscan(fid, '%f%f%f%f','Delimiter', ':');
data=cac{:,4};
HH=cac{:,1};
MM=cac{:,2};
SS=cac{:,3};
And tried to plot them using a timeseries function
ts1 = timeseries(data,(HH:MM:SS));
To my dissapointment it doesn't plot and the ts1 variable seems to be invalid.
Is there some other way of ploting time data ? Or am I using the timeseries function wrong ?
2 个评论
Slawomir Kania
2018-3-21
编辑:Slawomir Kania
2018-3-21
Von Duesenberg
2018-3-21
What if you simplify your workflow, load your data with the readtable function, convert your table to a timetable with the table2timetable function, and plot the first column against the second?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Time Series Events 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!