Matlab: Change Number Format to Remove Decimals

  • Context: MATLAB 
  • Thread starter Thread starter Moly
  • Start date Start date
  • Tags Tags
    Format Matlab
Click For Summary

Discussion Overview

The discussion revolves around formatting numbers in Matlab, specifically how to change the display of numbers to remove unnecessary decimal places for whole numbers. The context includes practical application and user experience with Matlab's formatting options.

Discussion Character

  • Technical explanation, Homework-related

Main Points Raised

  • One participant expresses frustration with Matlab displaying numbers with four decimal places for whole numbers and seeks a solution.
  • Another participant suggests consulting the documentation for formatting options in Matlab.
  • A later reply reiterates the suggestion to check the documentation and asks for specific options that would address the issue.
  • One participant proposes using the command "format short g" as a potential solution to the problem.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach, as there are multiple suggestions and no confirmation that any particular method resolves the issue definitively.

Contextual Notes

Participants mention the need for specific options but do not clarify which options are most effective or how they differ in application.

Who May Find This Useful

Users of Matlab who are looking to customize number formatting for improved readability in their outputs.

Moly
Messages
20
Reaction score
0
Hi All

Matlab is displaying numbers with 4 decimal places and i hate when it does that for whole numbers. for example i have a matrix C(i) that starts off from 1 down to 150/275. When i multiply it by 275 i get the first entry as 275.0000 and the last as 150.0000 how do i turn that off or instruct it not to do so.
 
Physics news on Phys.org
Try typing this in Matlab:

Code:
doc format
 
shoehorn said:
Try typing this in Matlab:

Code:
doc format

Thank you for your reply. i tried the first few before posting my question and could not really figure it out. any advice as to which specific option to use?
 
Code:
format short g

should work
 
thanks
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K