display comma in xlabel

26 views (last 30 days)
NOUF ALHARBI
NOUF ALHARBI on 10 Aug 2022
Commented: Image Analyst on 11 Aug 2022
Hi all
How can I change the format of the numbers in the x-axis to be like 10,000 instead of 10000?
number of rounds 10000 but I would like to display like 10,000.
How could I change it?
plot(1:Simulation,ooooo(2,:),'k-.');
title('PDR')
xlabel('Rounds');
ylabel('Time (ms)');
grid on

Accepted Answer

Star Strider
Star Strider on 11 Aug 2022
In the NumericRuler Properties documentation see TickLabelFormat to understand how to put the comma thousands separator in the tick format.
  9 Comments
Star Strider
Star Strider on 11 Aug 2022
@Walter Roberson — Thank you. (Internet here down for two hours this morning.)

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 10 Aug 2022
Turn the number into a string. See my attached little utility function.
  3 Comments
Image Analyst
Image Analyst on 11 Aug 2022
@Walter Roberson oh, okay. In that case you'd have to put in a check for the number of digits being 5 or greater if he wanted to use that function.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!