Number formats in Matlab [not to use e symbol]

In summary, the conversation discusses different formats for displaying numbers in Matlab and the desire for a custom format without the use of the 'e' symbol. The expert suggests looking into available formats and potentially creating a custom formatter function. They also provide an example of adjusting the string to remove the 'e' symbol. The conversation concludes with a specific request for a desired format and an expression of gratitude.
  • #1
mech-eng
828
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
  • #2
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^'
 
  • #3
Are you writing to a file, or are you wondering about command line display? And how would you like it to appear?
 
  • #4
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.
 

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

1. What are the different number formats available in Matlab?

Matlab supports several number formats, including double, single, int8, int16, int32, and int64. The default format is double, which is a 64-bit floating point number.

2. How can I change the number format in Matlab?

You can change the number format using the "format" command. For example, to change to single precision format, you can use "format single".

3. Can I display numbers in scientific notation without using the e symbol in Matlab?

Yes, you can use the "format short e" command to display numbers in scientific notation without using the e symbol. This will display numbers in the format of x.xxxe+yy.

4. How can I convert a number from one format to another in Matlab?

You can use the "cast" function to convert a number from one format to another. For example, to convert a double number to single precision format, you can use "cast(x, 'single')", where x is the double number.

5. Is there a way to limit the number of decimal places in Matlab?

Yes, you can use the "format" command with the "short" option to display numbers with a maximum of 4 decimal places. For example, "format short" will display numbers in the format of x.xxxx.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top