Saving Pdf Surf Hangs

6 ビュー (過去 30 日間)
Christopher Saltonstall
Christopher Saltonstall 2017 年 12 月 4 日
回答済み: Sonam Gupta 2017 年 12 月 8 日
Hello,
When I try to save a surf plot as a pdf Matlab hangs up and my disk usage jumps to 99% in task manager. However, when I save to any other format the code works fine. Can someone please explain? I used to save surface plots as pdf just fine.
clear
close all
savepath = 'C:\Users\';
% Image Sizing
japw = 3 + 3/8;
Y = 11;
X = 8.5;
XX = 0.5*X;
YY = 0.2*Y*japw/XX;
XX = japw;
PX = 0;
PY = 0;
%surface data (arbitrary)
x = (0:10);
y = (0:10);
nX = length(x);
nY = length(y);
xMat = repmat(x.',1,nY);
yMat = repmat(y,nX,1);
z = xMat.^2 + yMat.^2;
%plot data
f = figure(305);
hsurf = surf(x,y,z);
xlabel('X','fontsize',30,'interpreter','latex')
ylabel('Y','fontsize',30,'interpreter','latex')
shading interp
set(hsurf,'EdgeColor','interp')
colorbar
set(gcf,'color','white')
set(gcf,'PaperUnits','inches')
set(gcf,'PaperPosition', [PX PY X Y/2])
set(gcf, 'PaperSize',[X Y/2])
set(gca,'Position', [0.15 0.22 0.7 0.7])
set(gca,'FontSize',20)
view(0,90)
saveas(gcf,[savepath 'test3.pdf'])
  2 件のコメント
Sonam Gupta
Sonam Gupta 2017 年 12 月 7 日
The above code works fine with R2017a on my PC. Which version of MATLAB are you using and which operating system do you have?
Christopher Saltonstall
Christopher Saltonstall 2017 年 12 月 7 日
I'm using 2016b on Windows 10.

サインインしてコメントする。

回答 (1 件)

Sonam Gupta
Sonam Gupta 2017 年 12 月 8 日
I am not able to reproduce the issue in R2016b as well. I will suggest you to try following workaround:
1. Try increasing Java heap Memory. You can do this from MATLAB by going to Home>Preferences>General>Java Heap Memory. Set it some value above 400 Mb. Restart the MATLAB for changes to take effect.
2. Try switching to software opengl. To do the same, execute the following command in MATLAB command prompt:
opengl software
If this resolves the issue, then you can save the preferences such that future sessions of MATLAB also uses software opengl. Following is the command you can use:
opengl('save','software')

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by