# need a date array

2 views (last 30 days)
slowlearner on 6 May 2020
Commented: Rik on 6 May 2020
First of, you are gonna see me ask alot of questions in the time to come. I need to compare a whole year worth of data in order to determin if Vehichle 2 Grid is viable in the swedish market. now I have a matrice where I've compiled spotprices in min- avg-max between 2015-2019. The spot prices are hourly and my script will have to be the same sens I was thinking of using a callback funktion for everyhour I need. ofcourse i will have to make a schedule i.e. charge for x1 hours and drive for x2 hour, charge for x3hours and so forth. So I thought maby doing an hourly calendar and why i chose 2019 is becouse of leap year don't/can't take that in to account. but i was thinking of making a matrice by using the folowing line like below:
t1 = datetime(2019)+months(1:12)+days(1:end)+hours(0:23);
but it tells me that numeric input data must be a matrix with three or six columns, or else three, six or seven separate numeric arrays. it tells me to check 'ConvertForm' parameter but don't know what that is i thought maby just use the:
t2 = reshape (t1,8761,1);
to make it in to a list with a single column and input it with the spot prices but didn't work...
new to matlab i have like 2 books and they arn't much help with this project really...
thankful for any help.

#### 1 Comment

Rik on 6 May 2020

Rik on 6 May 2020
This is one of several options:
t=datetime(2019,1,1,0,0,0):hours(1):datetime(2020,1,1,0,0,0);

slowlearner on 6 May 2020
yes this is great stuff thanks alot!
Rik on 6 May 2020
You're welcome. I would highly encourage you to read the links I posted above. They can help you solve your questions on your own. The advice contained in them has often helped me solve my questions, on some occasions even while typing up the question.