Clear Filters
Clear Filters

How can I have a dd-mm-yyyy hh:mm:ss format on my axis x in a plot?

1 view (last 30 days)
I would plot a graph rain versus time. when i read my file by xlsread commands matlab does not read my date time. I have to import my excel file by import data icon and then define two vectors rain and time, then i define Y=RAINY x=TIME plot =(x,y) finally, matlab can draw a plot for me. the point is that it makes own format as date time for me on plot, april 2016 or may 2016. 1- i would like to have my own format or similar like DD,MM,YYYY hh:mm:ss because i have data for each minute and excel can show like that.
2- Why matlab can not read date time when i perform command xlsread series? it just shows second column as rain data. only [num,txt,raw] = xlsread(___) can read the date time in text format but i can not put it on my graph. Please, if you have a suggestion or command series let me know.

Accepted Answer

Star Strider
Star Strider on 11 May 2016
‘Why matlab can not read date time when i perform command xlsread series?’
It can. There are several ways to work with the date and time strings. One that will work in all MATLAB versions is to convert them to date numbers with the datenum function. If you have R2014b or later, you can also use the datetime functions. See the documentation for those functions for details on how to use them with your data.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!