How to write a "text" object inside axes??

7 visualizzazioni (ultimi 30 giorni)
Giovanni
Giovanni il 11 Ott 2012
Hello Everybody,
I have a question I am trying creating an animation to display some results using a normal MATLAB script (no GUI is involved into this process).
I have created a main figure which has several Childern, bwtween them there are some axes objects where I reproduce running graphs, or keeping a logo o writing some parameters.
I have another axes object where I am showing some frames which I am reading from a video, and showing by using imshow().
As on the top of this images there is a part which I don´t wann show, I have decided to create a black rectangle object and position it onto this part of the axes element. I did it simply creating an object with the right size and position, associating to it my axes element as 'Parent'.
imshow(read(vobj,n), 'Parent', h(13));
rectangle('Parent', h(13), 'Position', [0 0 320 20], 'FaceColor', [0 0 0]);
At this point I would like to add some text over this rectangle, but I am stuck on an error. I just try to do the same and create a text object overlapped to this rectangle:
K>> a = text('Parent', h(13), 'Position','String', 'Test')
Index exceeds matrix dimensions.
Whateve I am doint, even if I just give the 'Parent' property as input, I always get this error. Does anyone have an idea how can I solve this problem?
I can add every other kind of object to this axes, it just doesn´t work with text.
Greetings, Giovanni.

Risposte (1)

Razvan
Razvan il 11 Ott 2012
It seems you didn't specify the position vector...
a = text('Parent', h(13), 'Position', [???], 'String', 'Test')

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by