Changing Cell Format for Excel using MATLAB

How do I change cell format of Excel cells to Scientific which I need to plot. I use ActiveX Control as following Commands.
set(Excel.Selection.Font,'ColorIndex',7);
set(Excel.Selection,'HorizontalAlignment',3);
set(Excel.Selection.Interior,'ColorIndex',4);
set(Excel.Selection.Font,'Size',13);
set(Excel.Selection.Font,'bold',1);
if I use set(Excel.Selection.Format,'Scientific');
MatLab or excel does not support. pls help
"Thanks in advance"

 Réponse acceptée

Walter Roberson
Walter Roberson le 2 Juil 2012

1 vote

It appears to me that you should be setting NumberFormat instead of Format. What you should set it to depends on the details of the display you want.

3 commentaires

Hello Walter
Thanks for your advice,
I am trying to create a excel file, put some data, and again save as new excel sheet. In which i had some number in decimal format in the order of 3.8700e+11. when I put the data in Excel using following command
set(ActivesheetRange, 'Value', 3.8700e+11);
it prints as 387000000000. All I need to do is, If I can change the format of cell to Scientific, Excel can easily print the data properly. Pls help me on this context.
Even tried with set(Excel.Selection.NumberFormat,'Scientific');
Still I am finding error, what next to do
Walter Roberson
Walter Roberson le 2 Juil 2012
set the NumberFormat to '0.0000E+00'

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by