Filter löschen
Filter löschen

Date to vector error

1 Ansicht (letzte 30 Tage)
Kendal
Kendal am 18 Nov. 2022
Kommentiert: Campion Loong am 18 Nov. 2022
I am getting the following error:
"Error using datevec The input to DATEVEC was not an array of character vectors or strings."
when trying to run the following code:
%extract date information from the bicycle dataset;
date = EcoTotemBroadwayBicycleCount1(:,1);
% convert to numberic array to search through
dateNum = datevec(date);
  3 Kommentare
Jan
Jan am 18 Nov. 2022
@Kendal: Think twice. As the cyclist has mentioned already, the error message is clear. The readers cannot know, what the contents of EcoTotemBroadwayBicycleCount1 is, but you can check this.
By the way, "EcoTotemBroadwayBicycleCount1" is a really bad choice for the name of a variable. Names are not the right place to tell a story, because this impedes the readability and increases the risk of typos.
Campion Loong
Campion Loong am 18 Nov. 2022
Echo suggestions to attach data, and preferrably more code, to help the community help you. Other than that, do prefer using datetime to represent time points. Also see datevec documentation for the same recommendation:
"While you can represent dates and times as date vectors, it is recommended that you use datetime values to represent points in time, and duration or calendarDurationvalues to represent elapsed times."

Melden Sie sich an, um zu kommentieren.

Antworten (0)

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!

Translated by