How to remove decimal points in the Workspace

6 views (last 30 days)
Bradley
Bradley on 11 Jun 2024
Edited: Adam Danz on 11 Jun 2024
I want to remove decimal points in the workspace, I have a bunch of variables in the editor and want to be able to quickly reference the output in the work space but when i do they are in scientific notation. Ive tried changing the veiw but nothing works. Ill show an example below but some other things that I have tried is rounding, format longG and others, but nothing removes the decimal all together.
I have an excel sheet with alot of different variables, in numerous columns, I want to add all the values together to have just one total. Afterward Ill graph all of the different totals.
Heres how I am doing it now:
a1 =
339.750000000000
339.750000000000
339.750000000000
339.750000000000
339.750000000000
a2 = sum(a1);
output for a1 = 1.698750+03
a3 = round(a2,2);
after rounding, a3 = 1.698750+03
what I am looking for = 1698.75
When I open the variable in workspace I want it to look like the final number, 1698.75, instead of 1.698750+03. Any advice is appreciated!

Answers (1)

Adam Danz
Adam Danz on 11 Jun 2024
Edited: Adam Danz on 11 Jun 2024
See format to set output display format.
format shortg
or if you always want 2 decimal places,
format bank

Tags

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!