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

조회 수: 12 (최근 30일)
Giovanni
Giovanni 2012년 10월 11일
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.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by