MATLAB: How to save uitable & uifigure into pdf file

save to pdfuifigureuitable

I am generating a table and graph using uitable and uifigure function, and I need to save the uitable and uifigure into pdf file. However, the pdf file was successfully generated but it's blank. Is there anyway to do that? My codes are as follow: ________________________________________________
fig = uifigure('Name','Numbers'); t = uitable(fig,'Data',[2,4,6,8;1,3,5,7]); saveas(gcf,'Numbers','pdf')
________________________________________________

Best Answer

fig = figure('Name','Numbers');
t = uitable(fig,'Data',[2,4,6,8;1,3,5,7]);
saveas(gcf,'Numbers','pdf')
Apparantly there is some problem with uifigure while setting it as parent of uitable.