How to show a text on screen at the coordinates I give
Show older comments
For example i want "Hello" to appear at the coordinates (400, 500). Thanks
Answers (1)
Walter Roberson
on 24 Jun 2012
There is no good way to do this. text() is the only routine to place text on the screen that is not part of a user interface control, but text() always draws relative to an underlying axes, and text() always uses data coordinates. You would have to position an axes (which can be done in pixel coordinates), and draw on the axes, having carefully set your XLim and YLim to get the right positioning.
You can do something like
h = uicontrol('Style', 'text', 'Units', 'pixels', 'Position', [400 500 450 521], 'String', 'Hello')
This will, however, put the text within a box, rather than just painting the text on top of whatever else is there.
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!