把X,Y轴均标记:
str=[repmat(' X:',5,1) num2str(x') repmat(', Y:',5,1) num2str(y')];
//这里的5,表示标记几个点
也可以只标记X轴
str=[repmat(' X:',5,1) num2str(x')];
也可以只标记Y轴
str=[repmat(', Y:',5,1) num2str(y')];
x=1:1:5;
>> y=[0.1,0.5,0.8,0.6,0.7];
>> str=[repmat(' X:',5,1) num2str(x') repmat(', Y:',5,1) num2str(y')];
>> plot(x,y,'-o')
>> text(x,y,cellstr(str))
也可以把默认线条的颜色改为其它颜色,这里用黑色'k'来表示,且只标记Y轴
x=1:1:5;
>> y=[0.1,0.5,0.8,0.6,0.7];
>> str=[repmat(', Y:',5,1) num2str(y')];
>> plot(x,y,'-*',x,y,'k')
>> text(x,y,cellstr(str))
>> grid on