Thursday, 15 March 2012

Matlab: slow with converting date strings to datenum? -



Matlab: slow with converting date strings to datenum? -

with 100,000 date strings convert datenums, matlab slow... 20 seconds!! there faster way of doing this?

%strday %strtime dbldate = zeros(1, nlines); = 1 : nlines dbldate(j) = datenum([strday{i}, ' ', strtime{i}], 'yy.mm.dd hh:mm:ss.fff'); j = j + 1; end

internally, datenum big amount of fiddling around process many different date formats. calls internal function datenummx different input arguments depending on date format , syntax called datenum.

if know ahead of time syntax calling datenum with, , date format using, can phone call datenummx directly. since datenummx built-in mex file, , avoids overhead processing, typically vastly faster.

take datenum (type edit datenum) find out appropriate way phone call datenummx application.

(plus, vectorization other answers have suggested).

matlab

No comments:

Post a Comment