Converting yymmddhhmm to mm/dd/yy hh:mm for Figure
Mostrar comentarios más antiguos
I have a vector that has dates in the format of yymmddhhmm. When I create a time series contour plot, the dates show up as scientific numbers, but I want to display them as mm/dd/yy/ hh:mm.
1 comentario
Jan
el 25 de Mayo de 2013
Please post an example. It is not clear if your input is the string '0305231950' or the number 305231950.
Respuestas (1)
per isakson
el 24 de Mayo de 2013
Editada: per isakson
el 24 de Mayo de 2013
Try
str = '0305231950';
sdn = datenum( str, 'yymmddHHMM' );
datestr( sdn, 'mm/dd/yy/ HH:MM' )
And with a cell array of strings
str = {'0305231950','0305231951','0305231952'};
sdn = datenum( str, 'yymmddHHMM' );
datestr( sdn, 'mm/dd/yy/ HH:MM' )
which outputs
ans =
05/23/03/ 19:50
05/23/03/ 19:51
05/23/03/ 19:52
3 comentarios
Jessie
el 24 de Mayo de 2013
per isakson
el 24 de Mayo de 2013
Editada: per isakson
el 24 de Mayo de 2013
"entire vector"(?) See above for a cell array of strings
Craig Cowled
el 24 de Mayo de 2013
Have you looked at the help file on datevec?
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!