Export data and Format Cells in Excel using Matlab using ActiveX

조회 수: 18 (최근 30일)
India Aitkenhead
India Aitkenhead 2018년 3월 19일
답변: Guillaume 2018년 3월 20일
I'm exporting data to an excel file using ActiveX on Matlab and some of the data I'm exporting is in the format hh:mm:ss.sss. My data is supposed to be a quantity like 2 hours:45 minutes, not a time like 2PM, but excel automatically formats the cell and changes the numbers so that it's an AM/PM time. I can go into excel and change the cell formatting manually, but I would like this to be a one-step process because I'm processing lots of data. Is there a way to format individual cells to [hh:mm:ss.sss] using ActiveX while I'm writing to them or after I'm done writing data?

답변 (1개)

Guillaume
Guillaume 2018년 3월 20일
You can format individual or multiple cells at once with the NumberFormat property of your Range object. Something similar to:
yourrange.NumberFormat('hh:mm:ss.00'); %hh:mm:ss.00 is the excel format corresponding to matlab hh:mm:ss.sss

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by