Error using datenum (line 201) DATENUM failed.
이전 댓글 표시
Help me!
I have this error, and I don't know why.
Error using datenum (line 201)
DATENUM failed.
Caused by:
Error using dtstr2dtnummx
Failed to convert from text to date number.
My script is this:
[ndata, text, alldata]=xlsread('positive_read_Copia.xlsx'); % inside there are data (dd/mm/yyyy hh:mm:ss) and coordinates
date=date.';
tmp=char(date);
tmp_date=datenum(tmp,'dd/mm/yyyy HH:MM');
DateVector = datevec(tmp_date);
Date_minute=(tmp_date-tmp_date(1))*24*60; % Time, in minutes compared to the 1st georeferenced tweet
clear tmp;
댓글 수: 2
Cris LaPierre
2021년 11월 18일
Please share your spreadsheet. You can attach it using the paperclip icon.
Rachele Franceschini
2021년 11월 18일
답변 (1개)
Do not use outdated, discouraged, deprecated DATENUM (or for that matter DATEVEC or DATESTR).
Import your data using READTABLE, which automatically identifies the dates and imports them as DATETIME objects:
T = readtable('positive_read_Copia.xlsx')
D = T.tweet_created_at - T.tweet_created_at(1)
M = minutes(D)
댓글 수: 4
Rachele Franceschini
2021년 11월 18일
The code that you show in your comment is completly unrelated to my answer, so it is not clear what you expect from me. In any case, you should replace those deprecated functions with DATETIME and DURATION objects.
"but doing this I have another error"
Please show the complete error message. This means all of the red text.
Sean de Wolski
2021년 11월 18일
You'll also want to look at https://www.mathworks.com/help/releases/R2021b/stats/dbscan.html and either geobubble or geoplot https://www.mathworks.com/help/releases/R2021b/matlab/ref/geoplot.html.
Rachele Franceschini
2021년 11월 18일
카테고리
도움말 센터 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!