필터 지우기
필터 지우기

How do you place subscripts and superscripts on a panel on the fly.

조회 수: 7 (최근 30일)
Robert Garneau
Robert Garneau 2017년 5월 21일
댓글: Guillaume 2017년 5월 22일
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
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
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
Robert Garneau
Robert Garneau 2017년 5월 22일
I have a panel which i'm trying to place text to the left of a text box with the power of 10^-5 with the '-5' as a superscript(only with out the '^'). I'm also trying to use a subscript. I dont' see where you answer shows me how to do that. Right now i'm just placing the superscripts as a separate piece of text. see attached. Please be more specific.
Guillaume
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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by