Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

segmentation fault from saveas

865 views
Skip to first unread message

Al

unread,
Mar 7, 2008, 2:06:33 PM3/7/08
to
Running matlab with -nojvm will cause a segmentation fault if saveas
attempts to create a .emf file on my installation. There is no problem
with .fig files.

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?

Richard Quist

unread,
Mar 10, 2008, 9:00:30 AM3/10/08
to

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.

Donny

unread,
Mar 8, 2010, 11:31:06 PM3/8/10
to
Richard Quist <rquist...@mathworks.com> wrote in message <fr3bde$4sk$1...@fred.mathworks.com>...

> 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!

Sascha

unread,
Apr 27, 2010, 9:30:22 AM4/27/10
to
"Donny " <atd...@qq.com> wrote in message <hn4iua$71l$1...@fred.mathworks.com>...


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

Anne Sophie Dubarry

unread,
Jan 12, 2012, 9:57:08 AM1/12/12
to
Do you have any update on this issue? I tried the
set(gcf, 'paperpositionmode', 'auto'); with no success... It still gives me a segmentation fault error 139...




"Richard Quist" wrote in message <fr3bde$4sk$1...@fred.mathworks.com>...

Jan

unread,
May 13, 2013, 7:44:08 AM5/13/13
to
Dear all,

Any new ideas on solving this issue? I run also on a linux system R2009B and subsequently tried R2011A: same problem...

3490 Segmentation fault (core dumped)

Both the saveas and print function.
set(gcf, 'paperpositionmode', 'auto') doesn't help.

Looking forward to any helpful response!
regards, Jan-Joost.

"Anne Sophie Dubarry" <dub...@ccf.org> wrote in message <jemsc4$n4b$1...@newscl01ah.mathworks.com>...

Steven_Lord

unread,
May 13, 2013, 9:18:03 AM5/13/13
to


"Jan " <jjscho...@hotmail.com> wrote in message
news:kmqjm8$nk0$1...@newscl01ah.mathworks.com...
> Dear all,
>
> Any new ideas on solving this issue? I run also on a linux system R2009B
> and subsequently tried R2011A: same problem...
>
> 3490 Segmentation fault (core dumped)
> Both the saveas and print function.
> set(gcf, 'paperpositionmode', 'auto') doesn't help.
>
> Looking forward to any helpful response!
> regards, Jan-Joost.

Please contact Technical Support and work with them to determine the cause
of this problem, as I think it would be difficult to diagnose this over the
newsgroup.

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

0 new messages