Pages

Wednesday, December 4, 2013

How to Programmatically Format Command Window Text

References: http://undocumentedmatlab.com/blog/changing-matlab-command-window-colors-part2/
                    http://undocumentedmatlab.com/blog/bold-color-text-in-the-command-window/
                    http://undocumentedmatlab.com/blog/another-command-window-text-color-hack/


stringVar = 3.142; % some variable to use in the fprintf string function

% Red Text
fprintf(2, 'this is some text %1.3f', stringVar); % the 2 indicates an error message

% Blue Underlined Text (i.e. hyperlink format):
fprintf('this is some <a href="">blue underlined text %1.3f</a>', stringVar);

% Bold Text
fprintf('this is some <strong>bold text %1.3f</strong>', stringVar);

% Orange Text
fprintf('this is some [\borange text %1.3f]\b', stringVar);

No comments:

Post a Comment