Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



print and saveas segmentation fault with nodisplay
Posted:
Jul 16, 2013 4:29 AM


This seems to be quite an old but persistent problem,
Problem definition: when you try to save a figure to a file (e.g. pdf, png, fig, etc.) matlab exists with a segmentation fault (newer versions also give a core dump). It mostly seems to happen when the figure contains some patch or surface type objects.
When does it happen: When you run a matlab version on linux using the nodisplay (or nodesktop) option. I've tried many matlab versions ranging from 2007a to 2013a all seem to have the problem (for my figures).
Selection links of topics of others with this problem: http://www.mathworks.com/matlabcentral/newsreader/view_thread/311701 http://www.mathworks.com/matlabcentral/newsreader/view_thread/258144 http://www.mathworks.com/matlabcentral/newsreader/view_thread/165283 http://www.mathworks.com/matlabcentral/newsreader/view_thread/139979 http://stackoverflow.com/questions/13293956/segmentationviolationdetectedmatlab
Mentioned solutions: 1) Change the renderer: >> set(gcf,'Renderer','Painters') >> set(gcf,'Renderer','zbuffer') >> set(gcf,'Renderer','OpenGL')
2) Set openGL to software (which is already the default on unix, according to the manual) >> opengl software
3) Use smaller meshgrids, Aaron Hoffer (thread 139979) found that the problem was fixed when his grid was less then 80 by 80 pixels.
None of the solutions worked for me, for none of the tested matlab versions, after a lot of attempts and many segfaults I found the solution for my figures:
4) Don't use the latex interperpreter. Switching back to the normal text renderer for all my text objects (xlabels, titles, etc.) made the segmentation faults go away. Which is not really a solution, but at least now I can generate figures from our cluster.
Just my two pennies, good luck to anyone suffering from this "bug".



