Is there a format option for the DATESTR function within the Financial Toolbox that shows fractions of seconds?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have several data points within one second, and I would like to show the fractional parts of the second rather than rounding off to the nearest second as all the DATESTR formats do.
Respuesta aceptada
MathWorks Support Team
el 27 de Jun. de 2009
This enhancement has been incorporated in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
The ability to do use a DATESTR format that does not round-off the seconds is not available in MATLAB.
To work around this issue, you can customize the following function to suit your specific needs:
function out = newdatestr(T)
% This function converts a time, T, from the DATENUM format into
% HH:MM:SS.SSSSSS
%
% Here the seconds part retains 6 digits past the decimal. To change
% this number, change the number after the decimal after
% the last percent in the format string "f".
[y,mo,d,h,min,s] = datevecmx(T, 6);
f = '%2d:%2d:%2.6f\n';
out = sprintf(f, [h, min, s]');
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!