How can I output an array (with column, row headers) as an image?

조회 수: 7 (최근 30일)
This is a very basic question, but one I can't seem to figure out on my own.
I have a 5x6 array of data that I'd like to output as a table. I would like this table to be in the form of an an image file, I.e. a pdf, png etc. with row names, column names, and my data in the table. I don't want to output this as a text file, because I want to output this as a figure to be placed in a paper.
It may seem like this is something that I should simply enter manually into a table in Word (or similar), but the particular data changes frequently, and I'd like this process to be automated.
But I can't seem to save this as a PDF (perhaps I'm simply doing something wrong), and the program seems to be written for LaTex, which I do not use.
Any help appreciated. Best, Jonathan

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 6일
Use uitable() to create the table with appropriate headers. Set the 'data' property of the uitable() to a cell array of the values. For example if the values are stored in an array, then
set(handle_of_control, 'data', num2cell(YourArray));
Once you are done, use getframe() to record the table as an image data array, after which you can imwrite() as an image file.

추가 답변 (1개)

Jan
Jan 2013년 8월 6일
Installing LaTeX would be a good idea, when you want to create nice tables to be included in a PDF. LaTeX is free, powerful and state-of-the-art for nicely rendered text.
  댓글 수: 1
Jonathan
Jonathan 2013년 8월 6일
Hi Jan and Walter,
Thanks for the responses. These answers are what I needed to make sure I wasn't missing something! Looks like the GUI approach is the easiest, but the graphic itself that comes from it is pretty unappealing, so it sounds like I should invest in learning some LaTeX. I'll search for some resources. Feel free to suggest any good resources for the relatively coding-illiterate that might not obviously come up on a Google search...
While we're on the topic, though, I understand that there is a fair amount of difficulty rendering text nicely in graphical form, but this is surely a functionality Matlab should have--the more things Matlab does, the more I'll use it after all!
Thanks again, Jonathan

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by