Azzera filtri
Azzera filtri

Date to vector error

1 visualizzazione (ultimi 30 giorni)
Kendal
Kendal il 18 Nov 2022
Commentato: Campion Loong il 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 Commenti
Jan
Jan il 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 il 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."

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by