Thx
In general, you can just use trial and error. If you make the text box too small, then part of your text will not show. Then you can slowly adjust the size until it shows. I believe that if you set the units to characters, one character is 5 pixels wide by 13 pixels tall. And then there are a few pixels between each letter. So that should give you a way to make a good educated first guess, and then tweak.
a hint:
- to get an idea...
help textwrap;
us
> I have a static text uicontrol. I want to know what the minimum width and height (the last two elements of the Position proerty vector) settings are such that all the text will still be visible. I though I could get this with the Extent property, but this gives the same values as Position.
Same answer for 'Position' and 'Extent' property?!
Which OS and Matlab version?
On Windows with Matlab 6.5 and 2009a:
H = uicontrol('Style', 'text', 'String', 'a');
get(H, 'Position')
> 20 20 60 20
get(H, 'Extent')
> 0 0 10 18
set(H, 'String', 'asd')
get(H, 'Extent')
> 0 0 22 18
So actually the 3rd value of the property 'Extent' should satisfy your needs.
Did I miss the point?
Kind regards, Jan