如题,有用电时间序列数据形式的大数据,时间间隔1min,截取一年的数据。想通过matlab分段数据,按天画出用电量曲线。
序列模式如下:
16/12/2006;17:24:00;4.216
16/12/2006;17:25:00;5.360
16/12/2006;17:26:00;5.374
16/12/2006;17:27:00;5.388
...
16/12/2006;23:59:00;2.586
17/12/2006;00:00:00;1.044
17/12/2006;00:01:00;1.520
...
已尝试编写代码,但只画出了坐标系,没有曲线图。
fid=fopen('1.txt');
text=textscan(fid,'%s %s %f %*f %*f %*f %*f %*f %*f','delimiter',';');
fclose(fid);
A=datenum(text{1,1});
a1=unique(A);
[r,junk]=size(A);
m=2;
for j=1:m
for i=1:r
if datenum(text{1,1}{i,1})==a1(j,1)
x=[];
y=[];
x=[x text{1,2}{i,1}];
y=[y text{1,3}(i,1)];
else if datenum(text{1,1}{i,1})~=a1(j,1)
x=[];
y=[];
x=[x text{1,2}{i,1}];
y=[y text{1,3}(i,1)];
end
end
end
end
x1=datenum(x);
plot(x1,y);
datetick('x',13)
hold on;
后期想保存这些分段后的用电量,作为聚类的输入数据。