Change Excel Number Format From Matlab

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 comentarios

Jan
Jan el 7 de Oct. de 2011
Please use proper code formatting, as explained in the "Markup help" link.
George
George el 7 de Oct. de 2011
Sorry but i don't know how to use proper code formating
Fangjun Jiang
Fangjun Jiang el 7 de Oct. de 2011
When you post your question, look at the {}Code button above the text box.

Iniciar sesión para comentar.

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 7 de Oct. de 2011

0 votos

eActivesheetRange.NumberFormat='0.00'

6 comentarios

George
George el 7 de Oct. de 2011
Thanks for your help but if i put this the result is "000".
George
George el 7 de Oct. de 2011
I should put eActivesheetRange.NumberFormat='0,00'
with comma(,) not dot(.). Thank you very much
Fangjun Jiang
Fangjun Jiang el 7 de Oct. de 2011
I think you mean the opposite. '0.00' will make it show as 0.02.
'0,00' will make it show as 000
George
George el 7 de Oct. de 2011
I must put '0,00'.
Do you know how to plot to excel via matlab?
Thanks
Fangjun Jiang
Fangjun Jiang el 7 de Oct. de 2011
Okay, maybe that's a MS Office version thing.
I never had experience plot to Excel via MATLAB.
George
George el 7 de Oct. de 2011
It's fine. thank you very much

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 7 de Oct. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by