필터 지우기
필터 지우기

display comma in xlabel

조회 수: 30 (최근 30일)
NOUF ALHARBI
NOUF ALHARBI 2022년 8월 10일
댓글: Image Analyst 2022년 8월 11일
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

채택된 답변

Star Strider
Star Strider 2022년 8월 11일
In the NumericRuler Properties documentation see TickLabelFormat to understand how to put the comma thousands separator in the tick format.
  댓글 수: 9
NOUF ALHARBI
NOUF ALHARBI 2022년 8월 11일
Thank you so much Walter.
Star Strider
Star Strider 2022년 8월 11일
@Walter Roberson — Thank you. (Internet here down for two hours this morning.)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 8월 10일
Turn the number into a string. See my attached little utility function.
  댓글 수: 3
Walter Roberson
Walter Roberson 2022년 8월 11일
The challenge is that the user does not want the comma for 3141 -- only for 10000 or more.
Image Analyst
Image Analyst 2022년 8월 11일
@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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by