MATLAB: Automatically Position Text Annotations on a plot.

locationplotposition;text;

I am plotting many different plots in a for loop.
Is there any way to automatically position my text in the top right corner of the plot in all of the plots?
text('location','northeast','string1')
The line above does not seem to work.
Any ideas?

Best Answer

ylim=get(gca,'ylim');
xlim=get(gca,'xlim')
text(xlim(1),ylim(2),'yourtext')