フィルターのクリア

Printing Plots in Matlab

11 ビュー (過去 30 日間)
abe Martin
abe Martin 2016 年 10 月 3 日
回答済み: Joe Yeh 2016 年 10 月 4 日
I am trying to print a plot in Matlab and print it as a pdf but I keep encountering an error. I appreciate your help and input.
x = [2 4 7 2 4 5 2 5 1 4];
plot(x);
fig=gcf;
print(1,'-dpdf')
Warning: Files produced by the 'pdfwrite'
driver cannot be sent to printer.
File saved to disk under name 'figure1.pdf'.
> In name (line 73)
In print (line 200)
Error using name (line 102)
Cannot create output file '.\figure1.pdf'.
Error in print (line 200)
pj = name( pj );

回答 (2 件)

Joe Yeh
Joe Yeh 2016 年 10 月 4 日
The problem comes from your way of calling the command. When you do :
print(1, '-dpdf')
You're telling MATLAB to send data to printer number 1. This is apparently not what you intended to do. Instead, you should do this:
print('plot.pdf', '-dpdf')
Please consult Print documentation

Guðmundur
Guðmundur 2016 年 10 月 4 日
Try using saveas function, or switching the renderer, that might help.
x = [2 4 7 2 4 5 2 5 1 4];
filename = 'plot1';
plot(x);
set(gcf,'renderer','paint') % 'opengl' is default renderer
saveas(gcf, filename, 'pdf') % Save figure

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by