How to remove zeros from double value?
6 views (last 30 days)
Show older comments
Mira le on 18 Dec 2022
Answered: Walter Roberson on 18 Dec 2022
hi every one
I have a set D that contains values in double?
I want to display
D= 0.23, 0.52
VBBV on 18 Dec 2022
D = [0.2352 0.5263]
D = round(D(:),3) - [0.005 0.006].'
Dyuman Joshi on 18 Dec 2022
This won't work with random data, it depends on manually putting the values
D = [0.2352, 0.5263];
d = floor(D*100)/100;
fprintf('D = '); fprintf('%.2f, ', d(1:end-1)); fprintf('%.2f\n', d(end)); %must be one line for LiveScript
disp("D = " + strjoin(compose("%.2f", d), ', '))
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!