MATLAB Answers

command window

Can the numbers be displayed in command window in some colors. I mean ... 1 should be displayed in red color and 2 should be displayed in blue color.

Regards, Siva

Edit [27 Mar 2012, 08:25 BST - OK] Erased email address.



No products are associated with this question.

2 Answers

Answer by Oleg Komarov
on 27 Mar 2012

You can use this submission from the FEX: cprintf


An example with cprintf:

A = [5 6; 9 10];
cprintf('cyan'      , '%3.0f'   ,A(1));
cprintf('Magenta'   , '%3.0f \n',A(3));
cprintf('blue'      , '%3.0f'   ,A(2));
cprintf('green'     , '%3.0f \n',A(4));


Hi Oleg,
Thanks for your answer. I looked for the command in MATLAB. But i am unable to find any theory part relate to it. Could you elaborate little bit more or can you tell any links to read.


Oleg Komarov
on 27 Mar 2012

It's a submission of the FEX. Follow the link.


 I checked the link. Thanks for your help.

Regards, Siva


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!