i wanted to create a gui using matlab, which is supposed to look lyk the pic above.. wanted to know, is it possible to have the desire text in a text box? secondly, will it be possible for me to get them scrolled down too ??
i learned about textboxes and annotations too..but i dont think they'll work here.
can it all be possible with matlab gui or i'll have to switch over to another language?

 채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 8일

0 개 추천

Usually "textbox" refers to uicontrol('style','text') . Putting a uicontrol in the middle of a graph is possible but not nice to work with.
text() can place text anywhere on an axes, including on a drawing of a "word ballon".
text() works in data coordinates, and is compatible with scrolling.

댓글 수: 6

Shree Nath
Shree Nath 2012년 6월 9일
problem is.. is there any inbuild function for drawing objects like ballons or anything else?
dont tell me i'll have to draw the balloon function..??
Walter Roberson
Walter Roberson 2012년 6월 9일
There is no inbuilt function for drawing balloons.
Shree Nath
Shree Nath 2012년 6월 11일
can it take an image as the background ?
Walter Roberson
Walter Roberson 2012년 7월 8일
The scrollplot routine will scroll an image if it is part of the axes.
Note that it is not possible in MATLAB to place an image as part of "the background" to automatically appear under everything else and unaffected by the other graphics operations. images must always be placed in axes in MATLAB, so if you clear that axes (which happens automatically if you are not careful with "hold on") then the image would disappear.
It is possible to place the desired image into an axes and then do your other operations in a different axes on top of it -- provided that you do not try to subplot() which will delete existing axes that are underneath. Also you need to decide what you mean by "background" if you have an overlying plot: do you want to see the plot lines directly on top of the image? If so then you need to set the axes background color to 'none'
Shree Nath
Shree Nath 2012년 7월 9일
okay sir, seems i should give up havin an image in the background with a text.
~~actually, i am reading text files from a folder, and then displaying them, as you may see what our 'mobile chatbox is like'- the received and sent messages in a diffrent color, and all of'em arranged chronologically.~~
the new problem is, can i fix the width of a text box, whereas its height may vary according to the text contained inside?
Walter Roberson
Walter Roberson 2012년 7월 9일
See textwrap to do part of the work, to get the text to the right width. set() the control to that wrapped text. Then get() the Extent property of the control, and look at the height portion of the resulting vector (the third element): that will tell you how high the text box would have to be in order to fit the entire text. So then you can set() the box to be that high.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by