Why are the hour portions of my GMT times not being shown when I export data to Excel?

조회 수: 2 (최근 30일)
I'm attempting to export some GMT time tagged data to Excel, that looks like this;
21:48:52.03 78532.0390000000 0
21:48:52.80 78532.8050000000 0
21:48:53.55 78533.5550000000 1
But when I export it to Excel, the result is this;
48:52.03 78532.0390000000 0
48:52.80 78532.8050000000 0
48:53.55 78533.5550000000 1
I'm attempting to format column E's number format with the following:
I'm using MATLAB 2015A and Excel 2010.
In looking at the on-line documentation, this should work - and does with older versions of MATLAB (2010a) and Excel (2003).
I've tried different number format combinations. None of which work and I get the exact result (above) every time.
Am I missing something subtle or just implementing this incorrectly?
Thank you.

채택된 답변

Brad 2016년 2월 9일
For unknown reasons, I had to add the following 2 lines of code to solve this problem;
RangeObject = ActiveSheet.Range('CELL:CELL');
RangeObject.cells.EntireColumn.NumberFormat = 'hh:mm:ss.000');
I've never had to do this using previous versions of EXCEL. But for EXCEL 2010 it appears to solve the problem.

추가 답변 (1개)

Chad Greene
Chad Greene 2016년 2월 7일
It looks like exporting dates and times to Excel might require special treatment.
  댓글 수: 1
Brad 2016년 2월 9일
Definitely requires some kind of treatment. But I've found nothing definitive yet.

댓글을 달려면 로그인하십시오.


Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by