MATLAB Answers

About 3 significant digit?

6 views (last 30 days)
Ls
Ls on 11 Sep 2021
Answered: Jan on 11 Sep 2021
How do i present the output in 3 significant digit?

Answers (1)

Jan
Jan on 11 Sep 2021
fprintf('%.3g\n', pi)
3.14
fprintf('%.3g\n', pi * 1e6)
3.14e+06
fprintf('%.3g\n', pi * 1e-6)
3.14e-06

Products

Community Treasure Hunt

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

Start Hunting!

Translated by