Usually when you print a string in MATLAB:
disp('this will print black letters')
Can it be printed in color instead?
Change Output ColorsSelect MATLAB > Colors. In MATLAB Online, select MATLAB > Appearance > Colors.
%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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With