Borrar filtros
Borrar filtros

How do I make a vector where the entries are months and years?

7 visualizaciones (últimos 30 días)
Elias Beaini
Elias Beaini el 11 de Feb. de 2019
Editada: Stephan el 11 de Feb. de 2019
So I have this data set that needs me to plot the months of the year on the x axis for the years 2006 to 2012. What I mean by this is that I want to know how to make an array whose first entry is "Jan-2006", the next is "Feb-2006", the next is "Mar-2006" etc. until I reach "Dec-2012" (total of 84 entries). Could someone help me with this? Thanks

Respuestas (2)

Stephan
Stephan el 11 de Feb. de 2019
Editada: Stephan el 11 de Feb. de 2019
date = datestr(join([string(repelem(2006:2012,1,12)'),string(repmat(1:12,1,7)')],2),'mmm-yyyy')

madhan ravi
madhan ravi el 11 de Feb. de 2019
t = (datetime(2006,1,1):calmonths(1):datetime(2012,12,31)).'
t.Format='MMM-yyyy'

Categorías

Más información sobre Line Plots 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!

Translated by