MATLAB: Color Text Output Using the ‘publish’ Function

fprintfpublish

Good morning. Here's a question regarding the use of MATLAB's 'publish' function:
My goal is to make a couple of lines of text output as red letters. I can make it happen on the command window using the following line:
fprintf(2,'\nTEXT\n');
The issue at hand is that it does not output as such on the HTML document created using the 'publish' function, which is strange because so far everything has output as intended. During the course of researching the question, I came across 'cprintf' which, while wildly popular and seemingly useful, just won't work on my machine for whatever reason. The method above works just fine, though, because all I need is red. Thank you all very much in advance for your insight!

Best Answer

Hi Jeremy,
I am assuming that you are publishing it as an HTML document. So you can use html tag in your document. Add the font color command inside the html tag. I hope when you are publishing, this will resolve the issue.
Regards,
Anmol Dhiman