In this article on Mechanical Base, we will show the number and integer types in Matlab®. Before starting to learn Matlab® coding, you need to know the integer types and how to show them in an intended way in Matlab®. There is a command in Matlab® to do it.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
>> format long a=1.123165165165131215 a = 1.123165165165131 >>
If you want to show a number that has a very long decimal part on a long basis, you could type “format long” to show it in the first 16 characters at Command Window at Matlab® as above.
>> a=11231651651651.31215834 a = 1.123165165165131e+13 >>
If you do not use the “format long” code to show a number, the same number will be shown as above. The scientific expression as shown above means 10^8 in Matlab®.
>> format short a=1.312158346351 a = 1.3122 >>
Also, you can use “format short” code as shown above, the long decimal number or long integers will be shown as in 6 characters at Matlab® Command Window.
>> a = 100063226060.32622236; fprintf("%1.10f",a) 100063226060.3262176514>>
If you have a number like “a” in Matlab®, you can show this number’s intended decimals with the “fprintf” command as shown above. “1.10f” the 10f inside this code means, you want to show 10 strings after the decimal point of this number in the Matlab® Command Window.
The expression and displaying of numbers in Matlab® is like that.
Do not forget to leave your comments and questions below about displaying of numbers in Matlab® below.
If you want further coding examples about displaying of numbers in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.