How to display text in a plot as scientific number
조회 수: 11 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
dpb
2020년 8월 30일
Use a format string to create specific format desired...
>> sprintf('%.2e',pi*1E6)
ans =
'3.14e+06'
ergo, use
text(x,y,sprintf('%.2e',valueToPrint))
There's also num2str, compose that have some additional flexibility for specific uses...
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
