producing colored letters in an if statement

Is there any way to display the warning ‘Do that’ in the below if statement in red colour so that it can stand out?
If
'Do that'
end
thanks

1 Kommentar

Jan
Jan am 30 Jul. 2012
Do you mean inside the source code, when it is displayed in the editor? Or when printed to paper? Or displayed as strings in the command window? Or in a editable text field in a GUI?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Daniel Shub
Daniel Shub am 30 Jul. 2012
Bearbeitet: Daniel Shub am 30 Jul. 2012

0 Stimmen

You can do this with Yair's FEX:cprintf. Once you download and install the tool, you can do
cprintf('red', 'Do That');

3 Kommentare

salva
salva am 30 Jul. 2012
cprintf('Do That', 'red');
??? Error using ==> cprintf>processStyleInfo at 251
Invalid style - see help section for a list of valid style values
any suggestions?
Walter Roberson
Walter Roberson am 30 Jul. 2012
cprintf('Red', 'Do That');
Daniel Shub
Daniel Shub am 30 Jul. 2012
Bearbeitet: Daniel Shub am 30 Jul. 2012
@Walter, thank you
@Salva sorry about that, I got the syntax wrong. I edited the answer to the correct way.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by