display different colors in command window, using command "disp" or similar

269 次查看(过去 30 天)
I want sections of my display to be in differnt colors. (Matlab 2009)
ex:
disp('Hello matlab Central!')
Is it possible to get that text in example red?
disp('Hello matlab Central','red')
Thanks

回答(2 个)

Chunguang LI
Chunguang LI 2021-4-20
fprintf(2,'only red\n'); %2 for standard error.

Evgeny Pr
Evgeny Pr 2013-1-25
Use cprintf function.
This is an undocumented feature!

类别

Help CenterFile Exchange 中查找有关 Entering Commands 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by