Text on matlab plot

1 vue (au cours des 30 derniers jours)
Tj R
Tj R le 22 Mar 2013
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 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 22 Mar 2013
What does that means: I dont know how to dynamically change the integer from a file to the plot

Connectez-vous pour commenter.

Réponse acceptée

Wayne King
Wayne King le 22 Mar 2013
Modifié(e) : Wayne King le 22 Mar 2013
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

Plus de réponses (1)

Tj R
Tj R le 22 Mar 2013
Dear Wayne King, Thank you very much. It is working fine.
  1 commentaire
Image Analyst
Image Analyst le 22 Mar 2013
Modifié(e) : Image Analyst le 22 Mar 2013
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'.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by