DATE LOOPS AND DATE TRATEMENT IN MATLAB
2 views (last 30 days)
Show older comments
Im working with quite a lot of data and I want to use it in a Matlab code.
The data is identified for a certain time and and hour with a certain timestamp ( given as a number)
I want to create loops that are using the DATA especified for that certain timestamp.
I was trying to do so by generating a datetime array in matlab, as the following picture shows:
But when I am trying to do a loop such as:
for i=TIMED(1):TIMED(8774) X= UP(i)/1000 Y=Eoffered (i)*UP(i)
I have the following error:
Function 'subsindex' is not defined for values of class 'datetime'.
Error in ASS2 (line 15) Pelspot(TIMED)=ELSPOT(TIMED)/1000; % €/ kW
PS: I will have to use a lot of data and it is not always in order ( some values are repeated) so I want to get sure that only the values with that timestamp are used.
Thanks in advance !! =)
I have the data in an excel file, I dont know how to create a database but maybe is useful.
0 Comments
Answers (1)
Steven Lord
on 28 Mar 2017
What is the "December 31st, 2015 at 10 AM"-th element of the vector [15.86; 17.79; 18; 18.84; 19; ...]? Does that question even make sense?
If you're using release R2016b or later, store your data in a timetable. Since dates and times are an integral part of a timetable, you can index into a timetable using dates and times.
1 Comment
See Also
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!