Matlab exits unexpectedly after simple plot

3 visualizzazioni (ultimi 30 giorni)
Edit: I have submitted this as a bug. I got suggestions for workarounds, but the problem remains.
My goal is to make some scatterplots with large numbers of points (10^4 ish) and have two of these plots in one figure side by side.
I had problems with MATLAB quitting when creating this plot, and reduced the problem down to the following example.
% This script quits when attempting to print
% We will create a bunch of points (here on a meshgrid) and either plot a point there or not based on a random function v.
N = 200;
xx = linspace(0,1,N);
yy = xx;
[x,y] = meshgrid(xx,yy);
v = rand([N,N]);
bool = (v<0.01);
bool = bool(:);
fig = figure();
a1 = axes('position',[0,0,1,1]);
scatter(x(bool), y(bool), 10);
print('-dpng', 'testpic')
Some things that FIX the problem:
- Remove the explicit axes creation. However, I want this ability, since I want to place two axes next to one another.
- Don't print. However I need to print.
- Reduce the number of points. However, I can't be limited to 10^2.
- Modify the axes position to [0.1, 0.1, 0.8, 0.8].
I look forward to your collective insight.
John
  2 Commenti
Matt Fig
Matt Fig il 18 Nov 2012
Please include the MATLAB version number and the OS of your system (Ex. Windows 7 64-bit).
version % Show what this command returns
John Mahoney
John Mahoney il 22 Gen 2013
Matlab 8.0.0.783 (R2012b)
Mac OS 10.8.2
MacBook Pro 8 GB RAM
-John

Accedi per commentare.

Risposta accettata

Jan
Jan il 18 Nov 2012
Modificato: Jan il 18 Nov 2012
I confirm a crash of your posted code under Matlab R2009a/64 under Windows 7.
The crash happens inside the subfunction renderAnimatedKids in hg.dll, so it cannot be fixed directly. Please send the example to the technical support to report this bug.
I had success with changing the axes positions also:
a1 = axes('position', [k, k, 1-k, 1-k]);
with:
k = 1e-3; % Success
k = 1e-4; % Crash
This could mean, that there is a division by zero due to rounding errors.
The crash does not happen, if the figure is rendered by ZBuffer or OpenGL:
set(gcf, 'Renderer', 'ZBuffer')
  1 Commento
Image Analyst
Image Analyst il 22 Gen 2013
In MATLAB R2012b it first plots the data, then it all vanishes in a fiery kaboom with a not so helpful operating system message.

Accedi per commentare.

Più risposte (1)

Arsalan
Arsalan il 18 Nov 2012
Hi,
I am quite new to Matlab. you are saying that the plotting works by reducing the number of points, thus I can imagine that your PC might not have enough memory to process and store larger set of data points, try freeing up some of the programs which might be running on the background on the RAM as well as process which you are not using, and try again with points quite higher then 10^2 that did not run in the normal case. If it works then you don't have enough memory
Arsalan

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by