Using color in strings in MATLAB AppDesigner in UITextArea

Hi. I have designed a GUI using AppDesigner in MATLAB. I am using the UITextArea option to display outputs (strings) after a button is pressed. Is it possible to change the color of strings in the UITextArea individually? That is, if I have an output that says "Calculation done. Performance satisfied.", is it possible to have the "Performance satisfied" in some other color, for example, in green?
I am currently writing to the UITextArea using the sprintf command.

Answers (1)

Unfortunately, no the control is not flexible enough to allow this.
On the other, text area controls are more tailored for inputs so if the control is just for output display, you could use two label controls instead. One for the Performance satisfied and one the the rest. Each label can have its own text colour.

5 Comments

Could you please explain what you mean by two label controls? Do you mean that I would have to create two UITextArea?
No, two uilabel. Typically, you use label controls for text that is display only.
This is a very roundabout method. Moreover, I gave only an example of the text I want to display. Actually, the text I want to display is for nearly 10 lines. In those 10 lines, some should be colored and some are not. My interpretation is that according to your method, I would have to define a label for each string and associate a color with each string. This would not be a feasible way to execute the text coloring.
Please correct me if what you are trying to explain is different than my interpretation.
Thank you.
No, your interpretation is correct. Until App designer includes a rich type text type of control (no idea if that is planned, hopefully it is), or until it allows you to create your own control (unlikely), or it allows you to embed ocx controls (very unlikely) this is the only way to do it I'm afraid.

Sign in to comment.

Categories

Find more on App Building in Help Center and File Exchange

Products

Asked:

on 2 Jul 2019

Community Treasure Hunt

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

Start Hunting!