Export data and Format Cells in Excel using Matlab using ActiveX
19 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Guillaume
on 20 Mar 2018
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
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!