Hello dear community,
I want to display the text of a figure in different colors. The text consists of several strings which are displayed with the font color black. Dynamically strings should be added to the text line by line with a fixed color if a boolean variable is true. Unfortunately I have no idea how this could work.
Here is an example how I have tried:
set(mainHandles.text, 'String', [{'abc'};... {'dfg'};... {'hij'};... {'klm'};... {'stu'};... {'vwxyz'}]); %black font coulor
text_data = arrayfun(@(x) text(join(['\\color{x}sadfsdgs')),... cell2mat(Data(is_true,1)), 'UniformOutput', false);mainHandles.text.String = vertcat(mainHandles.text.String, text_modules);
mainHandles.text is the text object of the figure. Data contains the color of the respective string. With is_true the active strings are addressed.
Regardless of the fact that I have to reset the text of the figure with set, passing the font color in the string itself does not work – invalid parameter/value pair arguments.
Do any of you have an idea how I could make it all happen?
Many thanks for the help
Best Answer