필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Daniel Lemus
Daniel Lemus 2017년 8월 9일
답변: Jan 2017년 8월 9일
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')

채택된 답변

Jan
Jan 2017년 8월 9일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by