Effacer les filtres
Effacer les filtres

Problem with 'datevec' function ... I think a bug!

1 vue (au cours des 30 derniers jours)
Mohammad Monfared
Mohammad Monfared le 25 Juil 2012
First I should denote my Matlab version is R2011a. It's simple: running the simple code below
ans = datevec(input,'dd/mm/yyyy');
input is a cell array. there is no problem when its size is small but when it gets large (42600 in my case), this error is returned:
"??? Error using ==> dtstr2dtvecmx Failed on converting date string to date number.
Error in ==> datevec at 121 ans = datevec(input,'dd/mm/yyyy'); "
how can I deal with that? the function has no problem with a size around 1120 !!

Réponse acceptée

Titus Edelhofer
Titus Edelhofer le 25 Juil 2012
Hi,
this usually happens when somewhere down the array the strings are not valid anymore. A simple way to find out:
% assume inputArray to be your string array:
for i=1:length(inputArray)
fprintf('Convert entry %d', i);
t = datevec(inputArray{i});
end
Probably it will fail somewhere, but now you know which is the offending entry.
Titus
PS: BTW I would suggest another name than input, because input is a MATLAB function ...
  1 commentaire
Mohammad Monfared
Mohammad Monfared le 25 Juil 2012
yessss U are right... my misunderstanding of input data structure :D
thanks a lot,

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by