Borrar filtros
Borrar filtros

How to display a table object in command window in a different color

2 visualizaciones (últimos 30 días)
Hi
I am working with tables and I was wondering how to display the table in a different color. I know you can use the cprintf function for regular strings but it doesn't work if I try to pass an object table.
Ideally it should be something like this
MyTable = table (1, 2, 3)
disp(MyTable,'r')

Respuesta aceptada

Jan
Jan el 9 de Ag. de 2017
There is no direct way. You have to create a string at first, e.g. using evalc('disp(MyTable)').
This suffers from the same problems as eval and assignin, but if you do not use this to create variables, but catch the string output only, there is a chance that it does not make your code evil.
Are you really sure that this is useful? What about the output to a specific GUI? The command window has very limited possibilities only, and squeezing them might not be useful. As soon as more sophisticated output is required, a HTML display in a GUI might be smarter at all.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by