Thanks for your code.
It works well with Matlab 2007 but colors are not displayed on my computer with Matlab 2012b.
The text is displayed but in white in fact.
If I write cprintf('k','test\r\n', 4), the line is written in white with a blue "-" before the string
If I write cprintf('-k','test\r\n', 4), text is displayed in blue and underscored with a blue "-" before the string.