"Jonas " <joslaa02@student.umu.se> wrote in message
<fg0dqh$lt9$1@fred.mathworks.com>...
> Hello, I'm building a GUI and I like to know how to get a
> greek symbol for example in a static text or in a push
> button. I'd then like to write
>
> set(handles.static_text,'String','\alpha')
>
> to display the greek letter alpha but this doesn't work.
> Thanks!
"Dan " <dpcore@yahoo.com> wrote in message <fg0l33
$b7u$1@fred.mathworks.com>...
> "Jonas " <joslaa02@student.umu.se> wrote in message
> <fg0dqh$lt9$1@fred.mathworks.com>...
> > Hello, I'm building a GUI and I like to know how to get
a
> > greek symbol for example in a static text or in a push
> > button. I'd then like to write
> >
> > set(handles.static_text,'String','\alpha')
> >
> > to display the greek letter alpha but this doesn't
work.
> > Thanks!
>
> There is a submission on the file exchange for doing this
> at http://www.mathworks.com/matlabcentral/fileexchange/
> loadFile.do?objectId=10743&objectType=file
>
> Dan
Yes, that is one way to do it, although it is easy to run
the function i wonder if there is a simpler way to do it?
In article <fg1mnr$foh$1@fred.mathworks.com>,
"Jonas " <joslaa02@student.umu.se> wrote:
> "Dan " <dpcore@yahoo.com> wrote in message <fg0l33
> $b7u$1@fred.mathworks.com>...
> > "Jonas " <joslaa02@student.umu.se> wrote in message
> > <fg0dqh$lt9$1@fred.mathworks.com>...
> > > Hello, I'm building a GUI and I like to know how to get
> a
> > > greek symbol for example in a static text or in a push
> > > button. I'd then like to write
> > >
> > > set(handles.static_text,'String','\alpha')
> > >
> > > to display the greek letter alpha but this doesn't
> work.
> > > Thanks!
> >
> > There is a submission on the file exchange for doing this
> > at http://www.mathworks.com/matlabcentral/fileexchange/
> > loadFile.do?objectId=10743&objectType=file
> >
> > Dan
>
> Yes, that is one way to do it, although it is easy to run
> the function i wonder if there is a simpler way to do it?
If all you want is Greek letters then you can just use the Symbol font:
In article <fg5fia$epv$1@fred.mathworks.com>,
"Jonas " <joslaa02@student.umu.se> wrote:
> But what about a letter in normal size plus a subscript.
> For example to get a title for a plot with subscripts one
> would write
>
> title('E_\theta');
>
> So is there any simple way of doing this for a GUI control
> such as in a static text? Or is this really a limitation in
> GUI controls?
No, there's no simple way. UIcontrols don't use the tex or latex
renderers, I don't know why. Anyway, that's why I wrote uibutton. Just
use that.
--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
"Jonas " <joslaa02@student.umu.se> wrote in message
<fg5fia$epv$1@fred.mathworks.com>...
> But what about a letter in normal size plus a subscript.
> For example to get a title for a plot with subscripts one
> would write
>
> title('E_\theta');
>
> So is there any simple way of doing this for a GUI control
> such as in a static text? Or is this really a limitation in
> GUI controls?
You can use an undocumented feature of all Matlab
uicontrols, which is the fact that they use underlying Java
Swing controls, and these in turn accept any valid HTML
strings. So you can do the following for example:
This is equivalent to the tex string '\bf1_23^45\rm'. You
can set font faces, colors, sizes, bold/italic and any other
valid HTML 3.0 property. It's limited, but should do the
trick in most conceivable cases.
The same is true for tooltips, by the way: try setting
multi-line (<br>) multi-colored (<font color="red"> ...
</font>) tooltip once and you'll never use the standard
boring single-line black tooltip again...
And just in case you were wondering - yes, it also works for
menus, listboxes etc.
> You can use an undocumented feature of all Matlab
> uicontrols, which is the fact that they use underlying
Java
> Swing controls, and these in turn accept any valid HTML
> strings. So you can do the following for example:
>
> uicontrol
('string','<html><b>1<sub>2</sub>3<sup>4</sup>5</b></html>')
>
> This is equivalent to the tex string '\bf1_23^45\rm'. You
> can set font faces, colors, sizes, bold/italic and any
other
> valid HTML 3.0 property. It's limited, but should do the
> trick in most conceivable cases.
>
> The same is true for tooltips, by the way: try setting
> multi-line (<br>) multi-colored (<font color="red"> ...
> </font>) tooltip once and you'll never use the standard
> boring single-line black tooltip again...
>
> And just in case you were wondering - yes, it also works
for
> menus, listboxes etc.
>
> Yair Altman
> http://ymasoftware.com
>
Hello, this was a great feature I didn't know about.
However, this works with every uicontrol except with static
text, the one I needed. So I guess the text uicontrol
doesnt' have this underlying Java Swing control. But thanks
to all of you who tried to help.
The java syntax '<html>&lambda</html>' works great on the
recent MATLAB version with greek lambda.
But it does not work on a GUI fig created by 2006B version:
The text appears as it is on the screen:'<html>
&lambda</html>'. Is there a way to make it work on 2006B?
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.