Plot Time series data in date format
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I confused... if i have input data in .txt
exp : abc.txt
20110313000000 3.87
20110313000015 3.871
20110313000030 3.87
20110313000045 3.869 . . 20110313000130 3.844
20110313000145 3.83
20110313000200 3.824 ..
first column is date format (yyyymmddHHMMSS) and second column is the data
how if I want to plot in X axes in format '2011-March-11 00:15' (yyyy-MM-dd HH:MM)?
I write matlab
load abc.txt;
plot(abc(:,1),abc(:,2));
title('Tide time series 1116');
xlabel('time');
ylabel('Sea water level');
but it didn't give the right plot, anyone can help this basic problem.. thank you
0 comentarios
Respuesta aceptada
Walter Roberson
el 9 de Dic. de 2011
You can break up the number in the first column using pure numeric ways similar to what I used in http://www.mathworks.com/matlabcentral/answers/21688-is-there-a-more-effitiant-way-than-datenum-num2str-ftstempin-1-1
And if you don't have a lot of data to input and just want to get the code done, you can instead use
x = datenum(cellstr(num2str(abc(:,1))), 'yyyymmddHHMMSS');
plot(x, abc(:,2))
datetick('x', 'yyyy-mmmm-dd HH:MM');
Note the small modification of your format, from MM to mmmm as MM is minutes but you want the month name which is coded mmmmm
Más respuestas (0)
Ver también
Categorías
Más información sobre Time Series Objects 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!