customizing point names in matlab
6 views (last 30 days)
Show older comments
Is there a way to rename the point names in matlab plots? I know the following code will label the points from 1 to k.
for i=1:length(k)
text(xk(i),yk(i),num2str(i))
hold on
end
Is there a way to add a label to the points eg. s1,s2.... sk? TIA.
0 Comments
Accepted Answer
KSSV
on 11 Jan 2017
x = rand(5,1) ;
y = rand(5,1) ;
s = repmat('s',5,1) ;
n = [1:5]' ;
str = strcat(s,num2str(n)) ;
plot(x,y,'.r') ;
text(x,y,str)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!