Include 'FFF' in the date specifier for datestr()
http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html#bsplnu3-2
Include 'FFF' in the date specifier for datestr()
http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html#bsplnu3-2
MATLAB's date functions are very powerful, but this reduces their speed. If the dates need no verifications, because they have the correct format already, a direct approach is much faster. E.g. DATEVEC to dd-mmm-yyyy HH:MM:SS.FFF:
In = clock; months = ['Jan'; 'Feb'; 'Mar'; 'Apr'; 'May'; 'Jun'; ... 'Jul'; 'Aug'; 'Sep'; 'Oct'; 'Nov'; 'Dec']; Out = sprintf('%.2d-%s-%.4d %.2d:%.2d:%06.3f', ... In(3), months(In(2), :), fix(In([1, 4, 5])), In(6));
If speed does not matter for this task, I recommend Walter's DATESTR+'FFF' method.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!