Matlab exits unexpectedly after simple plot

3 ビュー (過去 30 日間)
John Mahoney
John Mahoney 2012 年 11 月 17 日
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 件のコメント
Matt Fig
Matt Fig 2012 年 11 月 18 日
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 2013 年 1 月 22 日
Matlab 8.0.0.783 (R2012b)
Mac OS 10.8.2
MacBook Pro 8 GB RAM
-John

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

採用された回答

Jan
Jan 2012 年 11 月 18 日
編集済み: Jan 2012 年 11 月 18 日
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 件のコメント
Image Analyst
Image Analyst 2013 年 1 月 22 日
In MATLAB R2012b it first plots the data, then it all vanishes in a fiery kaboom with a not so helpful operating system message.

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

その他の回答 (1 件)

Arsalan
Arsalan 2012 年 11 月 18 日
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

カテゴリ

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