Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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')

Akzeptierte Antwort

Jan
Jan am 9 Aug. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help 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