I\'m trying to draw an arrow in matlab graph, without any success.
Code example:
function [ output_args ] = example( input_args )
figure (\'Name\',
You can use arrow from the file exchange. arrow(Start,Stop)
draws a line with an arrow from Start to Stop (points should be vectors of length 2 or 3, or matrices with 2 or 3 columns), and returns the graphics handle of the arrow(s).
Edit: @Lama is also right, you can use annotation but you need to take into account the plot limits.
annotation('arrow',x,y)
creates an arrow annotation object that extends from the point defined by x(1),y(1) to the point defined by x(2),y(2), specified in normalized figure units. You can use the Data space to figure units conversion function (ds2nfu.m) from the file exchange to make your life easier.
[xf yf]=ds2nfu(x,y);
annotation(gcf,'arrow', xf,yf)
Note that there are some undocumented features that allow pinning annotations to graphs if that is needed, read more about it here...