For example
start at the command line with
matlab -nojvm
Create a trivial plot and attempt to save as a .emf
plot(1,2);
saveas(gcf, 'junk.emf');
Is this a known bug? Or is the jvm necessary to create a .emf file?
This is a bug although not one that I was aware of. R2008a reports an
error instead of seg faulting when you try this (message saying the JVM
is not running)
The same issue would occur if you use MATLAB's print command instead
of saveas.
The process is attempting to access a preference setting and that makes
use of the jvm.
Setting the figure's 'paperpositionmode' property to 'auto' may
prevent the crash from occurring and allow the file to be created.
set(gcf, 'paperpositionmode', 'auto');
--
Richard Quist
Software Developer
The MathWorks, Inc.
I met similar problems when I run the following program :
clear;clc;
if ispc
dir = [pwd,'\test\'];
else
dir = [pwd,'/Mwork/testData/'];
end
if ~exist(dir)
mkdir(dir);
end
t = -10:0.01:10;
f = -100:2:100;
sg = 0.5;
[T,F] = meshgrid(t,f);
Z = exp(-(T.^2 + F.^2)/(2*sg^2)) ;
mesh(T,F,Z);axis tight;
set(gcf, 'paperpositionmode', 'auto');
saveas(gcf,[dir,'mesh4'],'tif');
The version I used is 7.7.0.471 (R2008b)
And I run the program in the command line(No GUI) on a Linux platform.
It's OK until the program runs to the saveas function.
it returns "Segmentation fault" and then exit Matlab.
It's curious that the program will be normal if it runs on the WinXP platform or the var t is changed to "t = -10:0.1:10" on the Linux platform.
Because I have to process a big matrix such as Z, so what should I do if I want to save the image.
Thanks in advance!
Hej folks,
I encountered the same trouble today.
So no way of producing matlab figures within a cronjob :-( ...?
Donny, did you maybe find a solution to the problem?
Thanks,
Sascha