Ingesting fractional second timestamps
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am using the activex interface to excel to draw timestamp data from a file. The column I am drawing in is formatted as time I believe but it has an extra amount of precision. for instance the dates are of the form:
12:34:56.789
However MATLAB ingests this as a 4 digit decimal number like 0.5678 which when converted back to the time stamp later, throws away the fractional second precision. Any ideas on how to fix this? I need to match message timing with another files of the same form.
Here is my code:
dat_range = ['A25:A25000']; % Read to the last row overshoot
rngObj = exlSheet1.Range(dat_range);
exlData = rngObj.Value;
B = exlData;
clear exlData;
B(isempy(B))=[];
a.(platform).linkData.t = B;
lastrow = length(B);
clear B;
0 comentarios
Respuesta aceptada
dpb
el 8 de Jul. de 2015
I think you're mistaking the happenstance of the value with the formatting--Matlab will import the full precision of the value as stored in Excel even though it won't display the additional precision by default. Using your values above as example (don't have your actual spreadsheet so can't demonstrate from it)
>> datenum('12:34:56.789')
ans =
7.3597e+05
>> datestr(ans)
ans =
01-Jan-2015 12:34:56
>> datestr(datenum('12:34:56.789'),'HH:MM:SS.fff')
ans =
12:34:56.789
>>
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Export to MATLAB 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!