# Labelling graphs/images with text() function

#### nyxynyx

Hi, I'm plotting some circles in a 20x20 arrangement using the rectangle tool and I have to label each of the circle a number from 1 to 400. However, the following code does not do what i once, since i think i can only label with strings and not running numbers...

Code:
for i=1:400
text(x_pos(i),y_pos(i),i)
end
What else can i try? Thanks!

Related MATLAB, Maple, Mathematica, LaTeX, Etc News on Phys.org

#### f95toli

Gold Member
You could just convert the number to a string using the num2str function.
Look it up in the help.

#### nyxynyx

thnx f95toli this works!

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving