DATE LOOPS AND DATE TRATEMENT IN MATLAB
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162257/image.png)
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 Kommentare
Antworten (1)
Steven Lord
am 28 Mär. 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 Kommentar
André Bernal García
am 28 Mär. 2017
Bearbeitet: André Bernal García
am 28 Mär. 2017
Siehe auch
Kategorien
Mehr zu Time Series Objects finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!