How to display a number in a scientific notation in the plot?

35 views (last 30 days)
The code is below:
n=1000;
text(0.82,0.96, "$N =\mbox{ } $" +num2str(n), 'interpreter', 'latex', 'FontSize', 38) ;
I want that, "N =10^3" be displayed and not "N = 1000".
  8 Comments

Sign in to comment.

Answers (1)

Robert U
Robert U on 14 Jan 2022
Hi Vikash Pandey,
have a look at the function num2eng from Mathworks File Exchange. You can change easily the tick label:
fh = figure;
ah = axes(fh);
ph = plot(ah,1000:1000:10000,0:1000:9000)
ah.XTickLabel = num2eng(ah.XTick)
ah.YTickLabel = num2eng(ah.YTick)
Kind regards,
Robert

Tags

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!