How to display text in a plot as scientific number
Show older comments
How do I display a very small/large number in text command as a number with 2 digits after the decimel point?
e.g. 5.42e-6 rather than 0.00000542 or 5.4200e-06
thanks,
Ziv
Accepted Answer
More Answers (1)
n = 0.00000542;
nStr = num2str(n, '%.2e');
cla()
text(.1, .1, nStr)
% alternatively,
text(.5, .1, sprintf('%.2e', n))

1 Comment
Ziv Kassner
on 30 Aug 2020
Categories
Find more on 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!