필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Milad
Milad 2016년 5월 11일
답변: Star Strider 2016년 5월 11일
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.

채택된 답변

Star Strider
Star Strider 2016년 5월 11일
‘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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by