This is a static copy of a profile report

Home

datevec>getformat (40 calls, 0.120 sec)
Generated 05-Aug-2011 13:01:28 using cpu time.
subfunction in file /usr/local/MATLAB/R2011a/toolbox/matlab/timefun/datevec.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
datevecfunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
406
dtnumber = datenum(str, char(f...
400.077 s63.6%
407
str1 = dateformverify(dtnumber...
400.033 s27.3%
371
dashes = strfind(str,'-');
400.011 s9.1%
426
end 
400 s0%
410
break;
400 s0%
All other lines  0 s0%
Totals  0.120 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
datenumfunction400.077 s63.6%
timefun/private/dateformverifyfunction400.033 s27.3%
Self time (built-ins, overhead, etc.)  0.011 s9.1%
Totals  0.120 s100% 
Code Analyzer results
Line numberMessage
Coverage results
[ Show coverage for parent directory ]
Total lines in function113
Non-code lines (comments, blank lines)17
Code lines (lines that can run)96
Code lines that did run50
Code lines that did not run46
Coverage (did run/can run)52.08 %
Function listing
   time   calls  line
314 function [format] = getformat(str)
40 315 format = '';
40 316 formatstr = cell(11,1);
40 317 formatstr(1) = {'dd-mmm-yyyy HH:MM:SS'};
40 318 formatstr(2) = {'dd-mmm-yyyy'};
40 319 formatstr(3) = {'mm/dd/yy'};
40 320 formatstr(4) = {'mm/dd'};
40 321 formatstr(5) = {'HH:MM:SS'};
40 322 formatstr(6) = {'HH:MM:SS PM'};
40 323 formatstr(7) = {'HH:MM'};
40 324 formatstr(8) = {'HH:MM PM'};
40 325 formatstr(9) = {'mm/dd/yyyy'};
40 326 formatstr(10) = {'dd-mmm-yyyy HH:MM'}; %used by finance
40 327 formatstr(11) = {'dd-mmm-yy'}; %used by finance
328
40 329 AlphaFormats = [1 1 0 0 0 1 0 1 0 1 1];
330 %[1 2 6 8 10 11];
40 331 SlashFormats = [ 0 0 1 1 0 0 0 0 1 0 0];
332 %[3 4 9];
40 333 TwoSlashFormats = [ 0 0 1 0 0 0 0 0 1 0 0];
334 %[3 9];
40 335 DashFormats = [ 1 1 0 0 0 0 0 0 0 1 1];
336 %[1 2 10 11];
40 337 ColonFormats = [1 0 0 0 1 1 1 1 0 1 0];
338 %[1 5 6 7 8 10];
40 339 TwoColonFormats = [1 0 0 0 1 1 0 0 0 0 0];
340 %[1 5 6];
40 341 SpaceFormats = [1 0 0 0 0 1 0 1 0 1 0];
342 %[1 6 8 10];
343
40 344 bMask = [ 1 1 1 1 1 1 1 1 1 1 1];
345
40 346 if length(str) > 1
347 str = str(1,1);
348 end
40 349 str = strtrim(char(str));
40 350 slashes = strfind(str, '/');
40 351 if ~isempty(slashes)
352 bMask = bMask & SlashFormats;
353 if (~isempty(slashes) && slashes(1) == 2)
354 if (length(slashes) > 1 && slashes(2) == 4)
355 str = ['0' str(1:slashes(1)) '0' str(slashes(1)+1:end)];
356 else
357 str = ['0' str];
358 end
359 elseif (length(slashes) > 1 && slashes(2) - slashes(1) == 2)
360 str = [str(1:slashes(1)) '0' str(slashes(1)+1:end)];
361 end
362 if length(slashes) > 1
363 bMask = bMask & TwoSlashFormats;
364 else
365 bMask = bMask & ~TwoSlashFormats;
366 end
40 367 else
40 368 bMask = bMask & ~SlashFormats;
40 369 end
370
0.01 40 371 dashes = strfind(str,'-');
40 372 if ~isempty(dashes)
40 373 bMask = bMask & DashFormats;
40 374 if (~isempty(dashes) && dashes(1) == 2)
375 str = ['0' str];
376 end
377 else
378 bMask = bMask & ~DashFormats;
379 end
380
40 381 colons = strfind(str,':');
40 382 if ~isempty(colons)
40 383 bMask = bMask & ColonFormats;
40 384 if (~isempty(colons)) && (colons(1) == 2) && (length(str) - colons(end) <= 3)
385 str = ['0' str];
386 end
40 387 if length(colons) > 1
40 388 bMask = bMask & TwoColonFormats;
389 else
390 bMask = bMask & ~TwoColonFormats;
391 end
392 else
393 bMask = bMask & ~ColonFormats;
394 end
395
40 396 spaces = strfind(str,' ');
40 397 if ~isempty(spaces)
40 398 bMask = bMask & SpaceFormats;
399 else
400 bMask = bMask & ~SpaceFormats;
401 end
402
40 403 for i = 1:11
40 404 if bMask(i)
40 405 try
0.08 40 406 dtnumber = datenum(str, char(formatstr(i)));
0.03 40 407 str1 = dateformverify(dtnumber,char(formatstr(i)), false);
40 408 if (strcmpi(str, strtrim(str1)) == 1)
40 409 format = char(formatstr(i));
40 410 break;
411 end
412 catch exception %#ok<NASGU>
413 end
414 if AlphaFormats(i)
415 try
416 str1 = dateformverify(dtnumber,char(formatstr(i)),true);
417 if (strcmpi(str, strtrim(str1)) == 1)
418 format = char(formatstr(i));
419 break;
420 end
421 catch exception %#ok<NASGU>
422 end
423 end
424 end
425 end
40 426 end