Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我正在通过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 更多&回答... |
![]() |
![]() |