[ACCEPTED]-Mark points with a value in a MATLAB plot-plot

Accepted answer
Score: 16

You can display text on your plot by using 5 the functions NUM2STR, CELLSTR, and STRTRIM to format the coordinate 4 values into a cell array of strings and 3 using the function TEXT to display them:

strValues = strtrim(cellstr(num2str([X(:) Y(:)],'(%d,%d)')));
text(X,Y,strValues,'VerticalAlignment','bottom');

And 2 your plot will look like this for the sample 1 data above:

enter image description here

More Related questions