How to avoid the rounding off of data ?
76 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to perform the following divison operation.
l = 2.093750000000000e+09;
l/10^9
It was giving the output as:
ans =
2.0938
But i need the output as 2.09375 only. How an i achieve it ? I want to use it in further calculations as 2.09375 only. Is there any way to achieve this ?
l = 2.187500000000000e+09;
l/10^9
This was giving desired output in this case.
ans =
2.1875
If anybody knows how to solve this, please share your thoughts.
0 commentaires
Réponses (1)
Arthur Roué
le 30 Sep 2020
Modifié(e) : Arthur Roué
le 30 Sep 2020
There is no problem here, the default display format is set to short. Try :
format long
l = 2.093750000000000e+09;;
l/10^9
ans =
2.093750000000000
You can also access to the variable with the variable inspector : just double click on your variable in the workspace explorer.
5 commentaires
Steven Lord
le 30 Sep 2020
Use fprintf or num2str to create a string or char vector with the desired format then concatenate it with the string "Hz" using +.
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!