Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-10, 16:49   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 将终端下的Matlab不可见图另存为具有相同大小的图像

我正在通过SSH连接到Linux服务器并进行一些MATLAB编程。我想将无形的情节保存为

figH = figure('visible','off') ; % Plot something % save the plot as an image with same size as the plot close(figH) ; saveas()和print()将更改已保存图像的大小,而不是print()大小。同样对于print() ,所有三种渲染器模式( -opengl , -ZBuffer和-painters )都不能在Linux服务器上的终端仿真模式下使用。 getframe()也不起作用。我想知道如何解决这些问题?谢谢并恭祝安康!


回答:
使用以下命令序列连接并启动MATLAB:

ssh -x user@server # disabled X11 forwarding unset DISPLAY # unset DISPLAY variable matlab -nodisplay # start MATLAB without the desktop 然后用一个简单的图来说明:

figure, close # must do this first, otherwise plot is empty plot(1:10) # usual plotting print file # save the figure as file.ps saveas(gcf, 'file.eps', 'eps2c') # saveas aslo works exit # done 我只是自己尝试了一次,并且效果正常。

编辑:

您始终可以使用-r来指定DPI分辨率,例如,非常高分辨率:

print -dpdf -r600 file.pdf 请注意,您可以使用-r0指定屏幕分辨率。

您还可以使用PaperPositionMode属性打开所见即所得的图形打印

figure, close plot(1:10) set(gcf, 'PaperPositionMode', 'auto') print -deps2c -r0 file.eps exit

更多&回答...
poster 当前离线   回复时引用此帖
回复

主题工具
显示模式

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 01:37


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.