How do I change the output color when using the disp function?
0 Comments
Answers (2)
Hi @David Cole ,
It is not straightforward to change text color in MATLAB's command window using displ Also, after doing some research, it seems fprintf has limitations with ANSI codes and requires an environment that supports ANSI formatting. After doing some research, this is what I found at Mathworks file exchange as shown in the link below.
https://www.mathworks.com/matlabcentral/fileexchange/38252-tcprintf-ansi-colored-output-in-terminal
Also, I found out that you can use graphical functions like text for colored output in figures. By using the appropriate methods for your environment, you can achieve the desired visual effect using following code snippet below.
% Create a figure figure;
% Display colored text in a text object text(0.5, 0.5, 'This is orange text', 'Color', [1, 0.647, 0]); % RGB for orange axis off; % Turn off the axis
Please see attached.
Please let me know if you have any further questions.
0 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!