How do you place subscripts and superscripts on a panel on the fly.
3 次查看(过去 30 天)
显示 更早的评论
The panel is created using guide and text is placed using the set (handle.txt1,'String','10^{-3}') where txt1 is the tag of the text string that is being placed on the panel. How do I get substrings and superscripts on the panel screen. using Tex command '10^{-3}' doesn't work. I'm using Matlab 2017a.
1 个评论
Jan
2017-5-22
You forgot to mention the type of the handle.txt1 object. It is not a "text string", but it might be an uicontrol('Style', 'text').
回答(1 个)
Jan
2017-5-22
编辑:Jan
2017-5-22
You forgot to mention the type of the handle.txt1 object. It is not a "text string", but it might be an uicontrol('Style', 'text').
If you create an invisible axes and use text(), the LaTeX interpreter will work, in opposite to uicontrol's. If you really need an uicontrol, see: https://www.mathworks.com/matlabcentral/answers/269270-how-to-add-a-superscript-to-a-uicontrol
If the links solves your problem, note that it could be found by searching in the forum or in the net e.g. for "matlab subscript uicontrol".
2 个评论
Guillaume
2017-5-22
I thought Jan's answer was clear. Replace your current uicontrol with an invisible axes. In that axes place some text with the text() function. text within an axes can be formatted with LaTeX markup which allows superscripts, subscripts and more.
Your only other options are to use a different type of uicontrol (not text or edit) that support html or to delve into Java, as per Jan's link.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!