MATLAB: Labelling the (x,y) values corresponding to each data points on a graph

MATLABplottingtext;

Hi, This is the code for plot. There are around 9 data points. I want the x and y values to be displayed at each point on the curve. For example, at first point, display as '(0,1.0000)', second point, '(15,0.9563)' and so on.
load=[ 0 15 20 25 30 35 40 45 50];
Corr=[ 1.0000 0.9563 0.9419 0.9299 0.9166 0.9152 0.9085 0.8957 0.8881];
[xData, yData] = prepareCurveData( load, corr );
ft = fittype( 'smoothingspline' );
[fitresult, gof] = fit( xData, yData, ft );
figure( 'Name', 'Correlation Coeff Vs Deflection' );
h = plot( fitresult, xData, yData ,'*k');
Thanks in advance
athira

Best Answer

Hi Athira,
xOffsets = 0.0025*ones(1,9);
yOffsets = 0.0025*ones(1,9);
for i=1:9
text(load(i)+xOffsets(i), corr(i)+yOffsets(i), [num2str(load(i)) ',' num2str(corr(i))]);
end
something like this should work but make sure to suit your offsets . Goodluck, KL.