필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Mohammad Monfared
Mohammad Monfared 2012년 7월 25일
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 !!

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by