MATLAB: Noneditable “edit text” box to be able to select and copy part of the text

edit text uicontrol copy a part of textMATLAB

Hi,
1. Is there a way to create an "edit text" box, but don't allow it to be edited or modified? I want it so that a part of text can be selected and copied.
I don't want to do it with creating a button to copy entire text into the clipboard. I am trying to get capabilities of selecting a part of text and copying it, not the full text.
h = uicontrol('Style','edit','Position',[10 10 300 100],...
'min',0,'max',2,'enable','on');
str = {['x^2+e^{\pi i} Since its founding in 1984, MathWorks has become the leading ',...
'global provider of technical computing and model-based design ',...
'software. Headquartered in Natick, Massachusetts, MathWorks ',...
'global provider of technical computing and model-based design ',...
'software. Headquartered in Natick, Massachusetts, MathWorks ',...
'currently employs more than 1,000 people worldwide. ']};
set(h,'String',str) % display the string
2. I am also trying to get that equation to show up in tex or latex format, couldn't get around it. That's my second question how to get an equation to show up in an edit text box.

Best Answer

  1. You can set a uicontrol style edit 'Enable' to 'inactive' to have a text box that cannot be modified but can be scrolled. Unfortunately, selection is disabled . You would have to go in at the java level to do better.
  2. There is no hope of getting tex or latex in a uicontrol style edit, other than going in at the Java level.