Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
create a vector of months

Subject: create a vector of months

From: Kirk

Date: 15 Mar, 2010 16:29:10

Message: 1 of 2

I am trying to create of vector of months. Ex:

Jan
Feb
Mar
...

I started by creating a numerical representation of monrths 1:12, of the appropriate length using repmat:

 t = repmat(1:1:12,1,1200)';

From here it seems that I should be able to use datestr() to convert 1 to Jan, 2 to Feb, and so on. However, I seem to be at an impasse. Any ideas?

Subject: create a vector of months

From: Jos (10584)

Date: 15 Mar, 2010 20:33:09

Message: 2 of 2

"Kirk" <kwythers.nospam@umn.edu> wrote in message <hnln8m$7lu$1@fred.mathworks.com>...
> I am trying to create of vector of months. Ex:
>
> Jan
> Feb
> Mar
> ...
>
> I started by creating a numerical representation of monrths 1:12, of the appropriate length using repmat:
>
> t = repmat(1:1:12,1,1200)';
>
> From here it seems that I should be able to use datestr() to convert 1 to Jan, 2 to Feb, and so on. However, I seem to be at an impasse. Any ideas?


Months = 1:1:24
datestr(datenum(2000,Months,1),'mmm')

hth
Jos

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us