How can I create a text box with position (x,y) on top of an image?
5 views (last 30 days)
Show older comments
I have an image of discs and an accompanying n-by-2 matrix of disc centroid positions (x,y). I wish to plot the image and label each of the discs with a number.
When I attempt the obvious:
figure; imagesc(image1); hold on; daspect([1 1 1]); text(centers(1,1),centers(1,2),'X');
I receive the error message: "Subscript indices must either be real positive integers or logicals."
In fact, when I try the MATLAB-provided example:
x = 0:pi/20:2*pi; y = sin(x); figure; plot(x,y); text(pi,0,' \leftarrow sin(\pi)')
I receive the same error message.
Any idea what I'm messing up here?
Thank you very much, Michael
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!