I am forming an specific string using several strcat and displaying it into console. This string contains characters such as: 1,2,3,4,5,6,7,8,9,0,#,*,E and am using fprintf('%s') for this purpose.
For instance:
2E4137E65922#
is a possible outcome of the code.
Is there anyway I could make letter E to stand out in my output? Like making it red?
Thanks @Dev -iL for this information!
While it seems that cprinf() from my other answer does not work for single characters, if there is a single color that one wants to use, and that color is orange, then this trick used for warning in cprintf can be used:
disp(['this is [' 8 'orange]' 8 ' text'])
Read more at: http://undocumentedmatlab.com/blog/another-command-window-text-color-hack
Thus, your code would look like:
s='2E4137E65922#';
C=strsplit(s,'E');
str=C{1};
for ii=2:size(C,2)
str=[str ['[' 8 'E]' 8 ]];
str=[str C{ii}];
end
disp(str);

You can use the HTML tags <strong>, </strong> to type specific letters in bold:
str = '2E4137E65922#'; %// input string
letter = 'E'; %// letter that should be made bold
strBold = regexprep(str, letter, ['<strong>' letter '</strong>']); %// output string
disp(str)
disp(strBold)
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