Hello all,
since I would like to create a table, to illustrate data in Matlab, I used uitable.
Unfortunately I can't find a solution to save this table in a PDF.
Can someone help me? Also does not necessarily have to be created with uitable , should there be other possibilities?
Thats the code:
fig6 = uifigure;
uit = uitable(fig6,'Data',table_T,'Position',[20 80 500 160.5]);

 Respuesta aceptada

Adam Danz
Adam Danz el 10 de Oct. de 2022
Editada: Adam Danz el 11 de Oct. de 2022

1 voto

To save an image of the uitable to a pdf file, use exportgraphics. The second argument, filename, will be a path to your pdf document with the .pdf file extension. If you want to add it to an existing pdf file, see the append option.

5 comentarios

Lukas Schmid
Lukas Schmid el 11 de Oct. de 2022
First of all thank you Adam, the PDF has been created but it is unfortunately empty.
Also, it comes with this warning: Warning: UI components will not be included in the output.
This is my code:
fig6 = uifigure;
uit = uitable(fig6,'Data',final_table,'Position',[20 80 500 160.5],'ColumnWidth',{200});
exportgraphics(fig6,'Test.pdf');
Do you have any idea why the PDF is not created properly?
Adam Danz
Adam Danz el 11 de Oct. de 2022
exportgraphics is not set up to handle ui components (like that kind that appear in Apps). If you only want to export the axes, then ignore the ui components by using
exportgraphics(ax, ___)
where ax is your axes handle.
If you want to export the entire figure that contains ui components, use exportapp, but that does not have an append option.
Lukas Schmid
Lukas Schmid el 11 de Oct. de 2022
Almost Perfect! With exportapp it worked but unfortunately the contents of the table are not displayed:
Thats the code:
exportapp(fig6,strcat(path,'\figure6.pdf'));
It even worked once, i.e. the first time I tried it the table was exported perfectly, the next times it didn't even though I didn't change anything in the code?
Adam Danz
Adam Danz el 11 de Oct. de 2022
That doesn't sound good. Could you attach the fig file?
What does this return?
info = rendererinfo
Also see
Lukas Schmid
Lukas Schmid el 12 de Oct. de 2022
I dont know why but today it worked!!
Thank you Adam!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Productos

Versión

R2021b

Preguntada:

el 10 de Oct. de 2022

Comentada:

el 12 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by