Creating a time vector

Silly question:
How do I create a time vector from scratch, say beginning in 1981 and ending in 2010?
Thanks

2 Comments

Jan
Jan on 8 Jul 2013
It depends on what a "time vector" is.
per isakson
per isakson on 8 Jul 2013
Edited: per isakson on 8 Jul 2013
Is your question related to Time Series Basics in Matlab?

Sign in to comment.

 Accepted Answer

Jan
Jan on 8 Jul 2013
It depends on what a "time vector" is. Perhaps a datenum vector with a step size of days?
v = datenum(1981, 1, 1):datenum(2010, 11, 31);
A similar approach works for a stepsize of seconds or hours etc.

3 Comments

Kate
Kate on 9 Jul 2013
Exactly. Thanks a bunch.
pruth
pruth on 21 May 2018
hi, and what if I want this time vector with 1 min interval.? how to make it possible?
Kate
Kate on 21 May 2018
If you add another number after the 1 or 31 it would be a minute vector, then you can just extract that.

Sign in to comment.

More Answers (0)

Categories

Products

Tags

Asked:

on 8 Jul 2013

Commented:

on 21 May 2018

Community Treasure Hunt

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

Start Hunting!