Effacer les filtres
Effacer les filtres

Empty pdf if table is saved as pdf

5 vues (au cours des 30 derniers jours)
Chris Pruefert
Chris Pruefert le 7 Juin 2024
I am trying save the table t1 by uisng the suggested table-to-figure mathod. However, the saved pdf remains empty.
t1=table(ones(5));
fig = uifigure('Name','Numbers');
t = uitable(fig,'Data',t1);
exportapp(fig,'Peak_assigments.pdf')

Réponses (2)

Ganapathi Subramanian R
Ganapathi Subramanian R le 7 Juin 2024
Hi Chris,
The following code worked for me in saving the uitable along with its contents as a pdf file.
t1=ones(5);
fig = figure('Name','Numbers');
t = uitable(fig,'Data',t1);
saveas(gcf,'Peak_assignments','pdf')
I hope this helps.
Thanks

Milan Bansal
Milan Bansal le 7 Juin 2024
Hi Chris Pruefert,
I understand that you want to export a table create in MATLAB as a pdf but are facing issues with it.
Instead of using exportapp, you can use the print function and set the format type as "-dpdf". Please refer to the following code snippet for the implementation.
% Sample data for the table
data = {'Apple', 52; 'Banana', 89; 'Cherry', 50};
columnNames = {'Fruthe it', 'Calories'};
% Create the figure
f = figure('Position', [100, 100, 400, 200]);
% Create the table
t = uitable('Parent', f, 'Data', data, 'ColumnName', columnNames, 'Position', [20, 20, 360, 160]);
% Set the figure properties for better output
set(f, 'PaperPositionMode', 'auto');
set(f, 'InvertHardcopy', 'off');
set(f, 'Color', 'w');
% Save the figure as a PDF
print(f, 'table_output', '-dpdf');
Please refer to the following documentation link to learn more about print function.
Hope this helps!

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by