Add zero decimal digits in order to have all the elements of a matrix with same number of decimal digits
45 views (last 30 days)
Emilio Pulli on 4 Dec 2021
How can I add zero decimal digits to a number in order to have the same number of decimal digits in the numbers of a matrix? For instance, if I have only a "27" how can I change it to a "27.000"? I have already tried the function
in order to have the same decimal formt of all the elements of matrix A, but it does not work.
More Answers (2)
Rik on 4 Dec 2021
There is a distinction between the way data is stored and how it is displayed.
You can change the data type (double, single, cell, char, etc) to change the underlying data.
You can use functions like fprintf and sprintf to display your data a certain way.