在Matlab中打印图

时间:2016-10-03 23:32:23

标签: matlab

我正在尝试在Matlab中打印一个图并将其打印为pdf,但我一直遇到错误。感谢您的帮助和意见。

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 );

1 个答案:

答案 0 :(得分:1)

听起来你没有打印功能试图放置文件的任何地方的写权限。尝试使用绝对路径。

Linux上的示例:

print('~/figure1.pdf', '-dpdf');

或Windows

print('C:\MyFolder\figure1.pdf', '-dpdf');