MATLAB Number formats in Matlab [not to use e symbol]

  • Thread starter Thread starter mech-eng
  • Start date Start date
  • Tags Tags
    Matlab Symbol
AI Thread Summary
In Matlab, when displaying numbers in scientific notation, the default format uses the 'e' symbol, which some users prefer to avoid. To achieve a format without the 'e', one option is to convert the number to a string and replace 'e' with '10^', allowing for a more traditional scientific representation. The built-in 'format' options in Matlab, such as 'bank', provide limited decimal places, which may not meet the needs for precision. For more customization, users may need to create a custom formatter function. The discussion also highlights the importance of specifying whether the output is for command line display or file writing, as this can influence formatting choices.
mech-eng
Messages
825
Reaction score
13
When I write 1.516*10^-5 in Matlab it gives 1.516000000000000e-05 but I do not want to use e symbol. So which format should I use. I could use format bank but it has only two digits. I need more digits. Would you like to help me.

Thank you.
 
Physics news on Phys.org
Here's a list of available formats:

http://www.mathworks.com/help/matlab/ref/format.html

Perhaps, you can tell us what format you're looking for.

In any event, if its not listed you might have to find a custom formatter function or write one yourself.

As an example, if you simply wanted to remove the 'e' from the notation you could convert the displayed number to a string and then adjust the string to replace the 'e' with a ' 10^'
 
Are you writing to a file, or are you wondering about command line display? And how would you like it to appear?
 
mfig said:
Are you writing to a file, or are you wondering about command line display? And how would you like it to appear?

For example: When I do this operation I want it to seem as in a handy scientific calculation with fix is set.
>> 648*0.05^4

ans =

0.004050000000000

>> ans/(128*0.800*40)

ans =

9.887695312500002e-07

When fix is set as 6

The result seems to be 0.000003.

Thank you.
 

Similar threads

Replies
5
Views
2K
Replies
2
Views
2K
Replies
6
Views
2K
Replies
4
Views
3K
Replies
10
Views
3K
Replies
1
Views
2K
Replies
7
Views
3K
Replies
1
Views
1K
Replies
5
Views
2K
Back
Top