How to set a time windows vector

조회 수: 2 (최근 30일)
Stefano Di Vito
Stefano Di Vito 2018년 6월 12일
편집: Jan 2018년 6월 12일
Hi everyone! I've got this graph and i'd like to put on the x axis the correspondant time windows of my data. For example, the first bar refers to a date from 11/2006 to 11/2008; then, i switch one month for each following bar, as following:
  • 1st bar: 11/2006 to 11/2008
  • 2nd bar: 12/2006 to 12/2008
  • 3rd bar: 1/2007 to 1/2009and so on...Is there a way to set like this a vector to be used as unit of measurement on the x axis? Thank you a lot in advance
If it was not easy to do, how would i put a standard date vector as unit of measurement on the x axis?
  댓글 수: 3
Stefano Di Vito
Stefano Di Vito 2018년 6월 12일
image(M,'CDataMapping','scaled')
colormap([0,1,0;1,0,0])
M is a logical matrix, of dimensions (P,Treb) where P=80 and Treb=155. So, on the x axis i have the Trebs. They represent a specific time window; for istance, Treb=1 corresponds to 11/2004-->11/2006 and so on, switching month by month. I'd like to put the correspondant time window instead of 1,2,..., 155 of course for few Trebs values.
Jan
Jan 2018년 6월 12일
편집: Jan 2018년 6월 12일
My question remains the same: "Treb=1 corresponds to 11/2004-->11/2006" does not clarify, how the time information is stored in Matlab. Please provide this detail.
Did you read the documentation of datetick already? Define the XData correctly in the image command, then datetick solves the problem directly.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2018년 6월 12일
This seems to by a job for the datetick (link) command.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by