# Changing decimal numbers in variable editor in MATLAB

2 answers

Use `format bank`

2 decimal places to display. Read more about the function `format`

in the documentation .

If you want to change the way variables are displayed in the variable editor, take a look at this documentation page .

+5

source to share

If you just want to use the first 2 decimal places, you can add this line to your previous code:

```
out(:) = str2num(sprintf('%6.2f',out(:))); % 2 = number of decimals
```

It's not a pretty solution, but it truncates your values to the 2nd decimal place and keeps the following decimal places erased. You will still have some trailing zeros (until you fill in the chosen format for your variable editor as described above ).

+1

source to share