display comma in xlabel

30 visualizaciones (últimos 30 días)
NOUF ALHARBI
NOUF ALHARBI el 10 de Ag. de 2022
Comentada: Image Analyst el 11 de Ag. de 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

Respuesta aceptada

Star Strider
Star Strider el 11 de Ag. de 2022
In the NumericRuler Properties documentation see TickLabelFormat to understand how to put the comma thousands separator in the tick format.
  9 comentarios
NOUF ALHARBI
NOUF ALHARBI el 11 de Ag. de 2022
Thank you so much Walter.
Star Strider
Star Strider el 11 de Ag. de 2022
@Walter Roberson — Thank you. (Internet here down for two hours this morning.)

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 10 de Ag. de 2022
Turn the number into a string. See my attached little utility function.
  3 comentarios
Walter Roberson
Walter Roberson el 11 de Ag. de 2022
The challenge is that the user does not want the comma for 3141 -- only for 10000 or more.
Image Analyst
Image Analyst el 11 de Ag. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by