![]() |
将终端下的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 我只是自己尝试了一次,并且效果正常。 [B]编辑:[/B] 您始终可以使用-r来指定DPI分辨率,例如,非常高分辨率: print -dpdf -r600 file.pdf 请注意,您可以使用-r0指定屏幕分辨率。 您还可以使用PaperPositionMode属性打开[I]所见即所得的图形打印[/I] : figure, close plot(1:10) set(gcf, 'PaperPositionMode', 'auto') print -deps2c -r0 file.eps exit [url=https://stackoverflow.com/questions/1853259]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:01。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.