MATLAB Answers

Martin
0

Saving a table as PDF, - how can I rotate it 90 degrees

Asked by Martin
on 27 Aug 2019
Latest activity Commented on by Adam Danz
on 27 Aug 2019
Hello, I want to save a big table() which has like 20 columns. Therefore it would be nice to rotate the PDF paper 90 degrees.
When I save I use this
saveas(gcf,'summary','pdf')
and Matlab give me a size warning. Is there any way to rotate it?

  2 Comments

Are you saving a table, a figure, or a figure that contains a table?
Does the table exist as a variable?
Hi, thanks for turning back even though I was a bit unclear...
Yes the table exist as a variable, but I plot it inside a figure. When the figure "pops up" I am saving it as PDF

Sign in to comment.

Products

1 Answer

Answer by Adam Danz
on 27 Aug 2019
Edited by Adam Danz
on 27 Aug 2019
 Accepted Answer

If the table is saved as a variable, rather than saving a figure that shows the table, save the table itself to a text file. You can do that using writetable().
There are several benefits to saving the table to a text file rather than to a figure. The text file is readable if you ever need to read the table back into matlab. A figure will pixelate the text since the text is converted to an image.
If you'd rather save the figure to pdf, to rotate it, use orient().

  4 Comments

Show 1 older comment
The figure contains a PaperOrientation property and a PaperSize property that sets the orientation and size of the figure when you save it.
For example,
fh = figure();
fh.PaperOrientation % = [11, 8.5] (or whatever your standard is)
fh.PaperSize % = 'portrait'
Now we'll flip the orientation
orient(fh,'landscape')
fh.PaperOrientation % = [8.5, 11]
fh.PaperSize % = 'landscape'
% now save it
saveas(gcf,'summary','pdf')
Nice one there Adam! Thanks a lot buddy. Works like a charm!
Glad I could help!

Sign in to comment.