Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you print a string in MATLAB in color?

Tags:

matlab

Usually when you print a string in MATLAB:

disp('this will print black letters')

Can it be printed in color instead?

like image 715
Rook Avatar asked Sep 21 '09 23:09

Rook


People also ask

How do I change the output color in MATLAB?

Change Output ColorsSelect MATLAB > Colors. In MATLAB Online, select MATLAB > Appearance > Colors.

What does %s mean in MATLAB?

%s represents character vector(containing letters) and %f represents fixed point notation(containining numbers). In your case you want to print letters so if you use %f formatspec you won't get the desired result.

What is %f used for in MATLAB?

For example, %f converts floating-point values to text using fixed-point notation. Adjust the format by adding information to the operator, such as %. 2f to represent two digits after the decimal mark, or %12f to represent 12 characters in the output, padding with spaces as needed.


1 Answers

If you fprintf() to stderr, it can come out in another colour (depending on your preferences, I think).

There is undocumented functionality you can (ab)use to get more than this, though.

like image 144
Artelius Avatar answered Sep 19 '22 00:09

Artelius