例如,有一些数据1.0333329 0.609044 1 小丽1.336927 0.607161 1 小军1.352869 0.590259 2 小红1.333241 0.585688 3 小杰画图时如何把相应的名字显示在图上?我是新手,尽量把整个程序写上,哈
x=[1.0333329; 1.336927;1.352869; 1.333241] ;
y=[0.609044; 0.607161; 0.590259; 0.585688];
u=['1 小丽'; '1 小军'; '2 小红'; '2 小杰'];
figure
plot(x,y,'o')
for i=1:length(x)
text(x(i),y(i),num2str(u(i,:)))
end
直接运行此代码即可实现