how to filter data by date?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2024년 3월 4일
FilteredDataRealizedVol = FilteredDataRealizedVol(FilteredDataRealizedVol{:,1} <= datetime(2016,7,18),:);
댓글 수: 5
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Preprocessing Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!