Matlab crashes when plotting!

Here is a simple code to plot X,Y graph:
clear all; close all; fclose all; N=1000000; x=linspace(1,100,N); y=x.*x; plot(x,y,'o');
This program crashes Matlab when N is increased! But the same program runs if I have plot(x,y);
Any help? Thanks.

Réponses (3)

Jan
Jan le 11 Juil 2013

1 vote

Please explain, what "crash" exactly mean: Do you get an error message?
You want to draw one million circles in a diagram? Beside the crash, do you assume that the resulting graphics could be useful to demonstrate anything?
Try to specify the renderer:
x = linspace(1, 100, 1e6);
y = x^2;
figure('Renderer', 'OpenGL');
opengl software
plot(x, y, 'o');
opengl hardware
plot(x, y, 'o');
figure('Renderer', 'ZBuffer');
plot(x, y, 'o');
figure('Renderer', 'Painters');
plot(x, y, 'o');
If only the OpenGL hardware method crashs, try to update the drivers of your graphics card.

4 commentaires

Aditya Vaishya
Aditya Vaishya le 11 Juil 2013
Crash: Matlab closes without any error msg. Well, this is an example program demonstrating the problem which I am encountering while plotting high frequency measurement datasets were the array can be upto 3 million datapoints in length. Circles are not needed! You can have dots but then Matlab crashes!
I tried to update the graphics and run the code you send. But no luck! I am using Ubuntu 12.1 64 bit with 64 bit Matlab.
Jan
Jan le 12 Juil 2013
Modifié(e) : Jan le 12 Juil 2013
@Aditya: Please do not post only, that the code crashs, but try to run the 4 different shown methods to see, which of them fails. It is clear that one of them fails, but it matters which of them it is.
Shruthi  Suresh
Shruthi Suresh le 25 Mar 2015
Hi, I'm facing the same problem. Whenever I try to run the plot function, my Matlab (2014b) crashes. I even changed the graphics card settings to OpenGL with no luck.
Image Analyst
Image Analyst le 25 Mar 2015
Shruti, see the FAQ.

Connectez-vous pour commenter.

Shashank Prasanna
Shashank Prasanna le 11 Juil 2013

0 votes

Lets try to narrow down the issue.
Does this crash without the plot:
clear all
N=1000000;
x=linspace(1,100,N);
y=x.*x;
Or is it only with the plot?

1 commentaire

Try changing the renderer as Jan mentioned.
figure('Renderer', 'Painters'); plot(x, y);
It that works, then restart matlab and run the following:
opengl software
That should resolve the issue.

Connectez-vous pour commenter.

Aditya Vaishya
Aditya Vaishya le 11 Juil 2013

0 votes

Only when I plot.

1 commentaire

Shashank Prasanna
Shashank Prasanna le 11 Juil 2013
Please see my comment on the above answer. Please try and keep replys to answers as comments and not as a dedicated answer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by