Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Mohammad Monfared
Mohammad Monfared el 25 de Jul. de 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 !!

Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 25 de Jul. de 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 comentario
Mohammad Monfared
Mohammad Monfared el 25 de Jul. de 2012
yessss U are right... my misunderstanding of input data structure :D
thanks a lot,

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by