DATE LOOPS AND DATE TRATEMENT IN MATLAB
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Steven Lord
2017-3-28
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!