Text on matlab plot

조회 수: 1 (최근 30일)
Tj R
Tj R 2013년 3월 22일
Hi,
Thanks in advance for your answers. I would like to read integers from a file and i need to put on a matlab plot at a specified locations (by specifying the X and Y coordinates). Basically i know hot to put this text on a plot, but there is a difficulty in putting the integer numbers when it reads inside the loop, i dont know how to dynamically change the integer from a file to the plot. For example, i am using the "text" command, now the difficulty is, inside the text command how to update the integer value dynamically in side a loop?
Thanks
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 22일
What does that means: I dont know how to dynamically change the integer from a file to the plot

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

채택된 답변

Wayne King
Wayne King 2013년 3월 22일
편집: Wayne King 2013년 3월 22일
figure;
for nn = 1:10
h = text(0.45,0.45,num2str(nn));
pause(.5);
reset(h)
end
You can use num2str() as I demonstrate above

추가 답변 (1개)

Tj R
Tj R 2013년 3월 22일
Dear Wayne King, Thank you very much. It is working fine.
  댓글 수: 1
Image Analyst
Image Analyst 2013년 3월 22일
편집: Image Analyst 2013년 3월 22일
You can also use sprintf() to build up a more complicated string. Look into it. By the way, this (your "Answer") is not an Answer to your question. This should have been a comment to Wayne's answer and you should mark his answer as "Accepted'.

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

카테고리

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