Azzera filtri
Azzera filtri

Subplot - Plots are not displayed

45 visualizzazioni (ultimi 30 giorni)
MiauMiau
MiauMiau il 27 Gen 2013
Risposto: ks905383 il 12 Ago 2015
Hi
I use the following easy script do plot some functions in subplots:
x = [1 3 4 5];
y = [2.3 4.1 5.2 -1];
z = [1 1 1 1];
a = [12 13 44 1];
subplot(2,2,1); plot(x)
subplot(2,2,2); plot(y)
subplot(2,2,3); plot(z)
subplot(2,2,4); plot(a)
But when I run the programm, although no error message occurs, also no plots are displayed. Why so? Thanks
  2 Commenti
Matt J
Matt J il 27 Gen 2013
Works fine for me.
MK_Earth
MK_Earth il 29 Lug 2015
I had the same problem. I just closed and reopen Matlab to trubleshooting

Accedi per commentare.

Risposte (2)

the cyclist
the cyclist il 27 Gen 2013
The only thing I can think of is that your current figure window is either off your screen somewhere, or has the 'Visible' property set to 'off', so that it is not displaying.
What do you get for the 'Visible' property if you type
get(gcf)
Also, do you see the plots if you add a figure command in front of your plotting commands?
figure
x = [1 3 4 5];
y = [2.3 4.1 5.2 -1];
z = [1 1 1 1];
a = [12 13 44 1];
subplot(2,2,1); plot(x)
subplot(2,2,2); plot(y)
subplot(2,2,3); plot(z)
subplot(2,2,4); plot(a)
Failing that, I would restart MATLAB, and/or restart your computer. Not sure what to try other than that.
  2 Commenti
MiauMiau
MiauMiau il 27 Gen 2013
Modificato: MiauMiau il 27 Gen 2013
So, I tried it again and still I see no plots.
Again to repeat what I have done so far: the code
x = [1 3 4 5];
y = [2.3 4.1 5.2 -1];
z = [1 1 1 1];
a = [12 13 44 1];
subplot(2,2,1); plot(x)
subplot(2,2,2); plot(y)
subplot(2,2,3); plot(z)
subplot(2,2,4); plot(a)
has been saved in a .m file and I would just press the "run" button.
When I add "figure" I get an error:
Error using figure Error using figure Error using figure UIJ_AreThereWindowShowsPending - timeout waiting for window to show up
Error in Ex_1 (line 1) figure
And get(gcf) doesn't work either...:-/
the cyclist
the cyclist il 27 Gen 2013
I am not familiar with that error, but it suggests that MATLAB is somehow stuck trying to open a figure window.
You could try
>> close force all hidden
to try to shut all figure windows (and hopefully the pending one), and then try to run your code again.
Does this happen with a brand-new instance of MATLAB, in which you have not run any other commands? If so, that is extraordinarily weird to me, and I have no further suggestions other than to contact MathWorks support.

Accedi per commentare.


ks905383
ks905383 il 12 Ago 2015
So I had this problem as well, and after messing around for a long time, I found a fix - there seemed to have been an issue with the image renderer it was trying to use. Setting
set(gcf,'Renderer','zbuffer')
Fixed the problem for me (I haven't tried it for different renderers, and I still don't know why this might've happened, without an error message)

Community Treasure Hunt

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

Start Hunting!

Translated by