Effacer les filtres
Effacer les filtres

Change Excel Number Format From Matlab

21 vues (au cours des 30 derniers jours)
George
George le 7 Oct 2011
Hi
How to change excel number format to 2 decimal places from matlab using actxserver?
For example:
e = actxserver('Excel.Application');
eWorkbook = e.Workbooks.Add;
e.Visible = 1;
eSheets = e.ActiveWorkbook.Sheets;
eSheet1 = eSheets.get('Item', 1);
eSheet1.Activate;
eActivesheetRange = e.Activesheet.get('Range', 'A1');
eActivesheetRange.Value = 0.022432;
eActivesheetRange.NumberFormat = ????
I want excel to displa 0.02
Thanks
George
  3 commentaires
George
George le 7 Oct 2011
Sorry but i don't know how to use proper code formating
Fangjun Jiang
Fangjun Jiang le 7 Oct 2011
When you post your question, look at the {}Code button above the text box.

Connectez-vous pour commenter.

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 7 Oct 2011
eActivesheetRange.NumberFormat='0.00'
  6 commentaires
Fangjun Jiang
Fangjun Jiang le 7 Oct 2011
Okay, maybe that's a MS Office version thing.
I never had experience plot to Excel via MATLAB.
George
George le 7 Oct 2011
It's fine. thank you very much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Use COM Objects in MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by