how to filter data by date?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Manny
am 4 Mär. 2024
Beantwortet: Steven Lord
am 4 Mär. 2024
hi everyone
I am trying to filter records by date. I am getting error. How do I fix it?
Code:
Data = convertvars(Data, 2, @(x) datetime(x, 'InputFormat', 'yyyy-MM-dd'));
FilteredDataRealizedVol = Data(:,["TRADE_DATE","REALIZED_VOLATILITY"]);
FilteredDataRealizedVol = FilteredDataRealizedVol(FilteredDataRealizedVol(:,1) <= datetime(2016,7,18),:);
FilteredDataRealizedVol = FilteredDataRealizedVol(FilteredDataRealizedVol(:,1) >= datetime(1928,1,27),:);
Error:
Error using <=
This operation is not defined between 'table' and 'datetime'. The input that is not a table or timetable must be a numeric or
logical array.
Error in LinearRegression (line 26)
FilteredDataRealizedVol = FilteredDataRealizedVol(FilteredDataRealizedVol(:,1) <= datetime(2016,7,18),:);
Thank you
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Mär. 2024
FilteredDataRealizedVol = FilteredDataRealizedVol(FilteredDataRealizedVol{:,1} <= datetime(2016,7,18),:);
5 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Dates and Time 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!