delay 发表于 2015-10-6 21:27

Matlab中copy figure时出现错误


Matlab中copy figure时出现错误
error: Attempt to execute SCRIPT print as a function!

请问这时怎么回事?怎么解决

ChaChing 发表于 2015-10-7 12:13

Ref: http://home.vibunion.com/blog-63979-18250.html
2.常见的程序出错问题整理 http://forum.vibunion.com/thread-46001-1-1.html
   6F->Attempt to execute SCRIPT conv as a function

happy 发表于 2015-10-8 10:27

通过你的描述无法了解你的问题具体是哪种原因导致的
不过当copy figure不可用时可以采用以下的方法解决

1 可用 saveas, 例如:
F=(函数/其他)
for rrrr=1:100
F=F+5;
plot(F);
saveas(gcf, 'num2str(rrrr)', 'bmp');
end
% gcf = the current figure will be saved as 1.bmp, 2.bmp,3.bmp ...
%bmp 可换成你想要的图像格式,如 tif, fig, ....

2 用法:print(图形句柄,存储格式,文件名);
图形句柄,如果图形窗口标题栏是“Figure 3”,则句柄就是3.用gcf可以获取当前窗口句柄。
指定存储格式。常用的有:
png格式:'-dpng‘ (推荐这一种,与bmp格式一样清晰,文件也不大)
jpeg: ‘-djpeg‘(文件小,较清晰)
tiff: ‘-dtiff‘
bmp: ‘-dbitmap‘(清晰,文件极大)
gif: ‘-dgif‘(文件小但不清晰)
文件名:自己给定
注意::print函数必须紧跟在plot函数之后使用。

delay 发表于 2015-10-16 14:49

happy 发表于 2015-10-8 10:27
通过你的描述无法了解你的问题具体是哪种原因导致的
不过当copy figure不可用时可以采用以下的方法解决

...

谢谢耐心地回复
页: [1]
查看完整版本: Matlab中copy figure时出现错误