MATLAB: Customizing point names in matlab

MATLABnaming pointsplots

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.

Best Answer

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)