필터 지우기
필터 지우기

How can I use the text and sprintf functions to label a point on a graph?

조회 수: 47 (최근 30일)
I need to label a point with its coordinates (x = 5/6, y = 6/9) correct to 4 decimal places. The line y consists of one plot, hence the (x, y, str). When I try the following code no label appears on my graph.
x = 5/7:5/7;
y = % equation of line
plot(x, y);
str = sprintf('%0.4', 5/7, 6/9);
text(x, y, str);

채택된 답변

Star Strider
Star Strider 2014년 10월 25일
Try this:
text(5/7, 6/9, str);
  댓글 수: 4
Andy
Andy 2014년 10월 25일
Whoops. I added the 'f', works now. Thank you very much
Star Strider
Star Strider 2014년 10월 25일
My pleasure!
It happens to us all...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by