I have a uitable
in a figure
that I am trying to save as a pdf using exportgraphics
. I
believe I need to use exportgraphics
because I need to append many figures into a single pdf. Saveas
can successfully create the pdf, but it lacks the option to append to an existing file. Saveas
could work if there's a way to programmatically stitch 500+ pdf files together.
My figure contains 3 axes
objects, 1 annontation
and the uitable
. The figure
and uitable
are created like this:
T = array2table(data);
T.Properties.VariableNames = labels;
... lines to create the plot data ...
fh = figure;
fh.PaperType = "uslegal";
fh.PaperOrientation = "landscape";
fh.PaperUnits = "normalized";
ut = uitable(fh, Data=T{:,:}, ColumnName=T.Properties.VariableNames);
... many lines of formatting and plotting
exportgraphics(fh, 'test.pdf', Append=true)
The result is
Warning: UI components will not be included in the output.
And a pdf which contains the graphics and annotation, but no uitable
. How can I properly create a multi-paged pdf file of figures containing uitable
s
You have a few options here. As you've seen, exportgraphics
cannot deal with uitable
. This doc page summarises the different export options.
To proceed, I would suggest either
Use a command-line tool to concatenate the PDFs after creating them with saveas
. See for example https://unix.stackexchange.com/questions/3378/modifying-pdf-files
A truly hacky solution would be to use saveas
to export a PNG or similar, and the read that back in to use exportgraphics
in Append=true
mode.