Why do i get a figure window that is completely blank

196 visualizzazioni (ultimi 30 giorni)
Neel
Neel il 22 Mar 2025
Modificato: Brian Taylor il 29 Set 2025 alle 1:05
  2 Commenti
John D'Errico
John D'Errico il 22 Mar 2025
Questo/a commento è stato/a segnalato/a da Brian Taylor
I am right now using my MATLAB crystal ball to see inside your computer, and to then read the code you wrote that produces this. Sadly, the crystal ball is so often foggy, so it might help if you just show us the code you wrote. Well, if you want help that is. Until then, the only possible answer is:
PROBABLE USER ERROR
Star Strider
Star Strider il 25 Set 2025 alle 3:39
I had a problem similar to this about three months ago (Ubuntu 24.04, MATLAB R2025a). It turned out to be solved with an Ubuntu update. Everything worked perfectly after that, and has since.
Neither MathWorks (Tech Support was extremely helpful) nor I ever figured out what the problem was, since the update solved it in the interim.
You didn't state the OS or version you are using, so consider updating it as one option.

Accedi per commentare.

Risposte (4)

John D'Errico
John D'Errico il 22 Mar 2025
Spostato: John D'Errico il 22 Mar 2025
I will point out that IF you just use the function figure, like this:
figure
It will produce a new (and blank) figure window. So, SOMEPLACE, you are probably doing exactly that in some way. We don't know how or why or where you did that, but we can surmise this was almost certainly your problem. There were also 4 other open figures, so the new figure window was number 5.

Walter Roberson
Walter Roberson il 22 Mar 2025
Possibly you have not written any graphics to that figure.
Possibly your code depends on using the default figure or the default axes (this is very very common!) but your default figure has changed -- for example if you click on a different figure (perhaps to move it) then that other figure becames the default figure.
Possibly an axes was created in the figure, but the axes position is outside of the figure boundaries.
Possibly you are encountering an error in the graphics drivers.

Image Analyst
Image Analyst il 22 Mar 2025
I have found out that if youi used App Designer to make a figure with some axes on it and then you do something like "hold on" or imshow without giving it the name of the axes on your figure, then it will open up a brand new figure. App Designer doesn't seem to understand the concept of "current axes" or "gca" like a regular script will, or like GUIDE does. You must give it an axes handle if you call any graphics or imaging calls, otherwise it will open up a new figure. For example
cla reset; % Opens up a brand new figure because you didn't specify the axes handle.
imshow(grayImage, 'Parent', app.axes1); % Opens image in axes1
hold on; % Opens up another brand new figure because you didn't specify the axes handle.
plot(app.axes1, 1:10, 'r-'); % Because hold on didn't work, this blows away the image
% and plots into axes1
hold(app.axes1, "on"); % Now giving it an axes
plot(app.axes1, rand(1, 10)*10, 'b.', 'MarkerSize', 30); % Adds to plot in app.axes1.
Kind of quirky, but that's the way it is.
  1 Commento
Walter Roberson
Walter Roberson il 22 Mar 2025
The real issue is that uifigure() default to HandleVisibility 'callback', so gcf() do not normally find them. If you specifically set the uifigure() handle visibility to 'on' then gcf() will find them.

Accedi per commentare.


Brian Taylor
Brian Taylor il 25 Set 2025 alle 0:42
Modificato: Brian Taylor il 25 Set 2025 alle 0:46
So in matlab 2025, I have discovered that if I have my figures undocked when starting up. Even if a plot has previously run and displayed correct. the figure will come up blank no matter how many times I run the plot. At this point the only way that I have found to get them to display is to dock the figures back into the main console, then I can undock them and they work just fine.
I will say that answers like the one presented by, especially the first one, John D'Errico, a complete waste of time and space. It is especially frustrating when it is by someone who is suppose to be an MVP. Why bother answering a question if you immediately accuse the user of an error. It is counter productive in an environment of new and old users. IF you don't have anything useful and are unwilling to help someone, do us a favor and keep it to yourself.
Macbook Pro, Apple M3 Pro, Sequoia 15.6.1, Matlab R20205 Update 1
  4 Commenti
Image Analyst
Image Analyst il 28 Set 2025 alle 15:48
Personally, I don't consider my answer to be "a complete waste of time and space." I've been using MATLAB for decades and what I demonstrated was a surprise to me (i.e., omitting axes handles used to apply to the latest axes you did something with, not open up a completely new figure like it does now (sometimes).) Most people would assume you had an extra, unnecessary call to figure somewhere, but I wanted to add that it's possible to have an extra figure pop up even when you never called the figure function expllicitly at all.
So while you thought it was a waste and didn't learn anything from it, a lot of times others read these answers later, so I guess it might help some of them.
All the answers given here are essentially instructions "that can be found elsewhere" but we understand that the documentation can be extensive and overwhelming and not easy to find what you need. So that's why people ask questions here and we offer concise solutions so that people don't have to spend hours looking elsewhere (documentation).
Brian Taylor
Brian Taylor il 29 Set 2025 alle 1:04
Modificato: Brian Taylor il 29 Set 2025 alle 1:05
Did you attack the user giving a flippent answer regarding blaming the user? No, Image Analyst, you did not, my comment did not apply to you. I did not consider your answer a complete waste of time and space either. I called out a specific user with a very specific type of answer. I have notice a trend on knowledge boards where the trolls give flippent and useless responses, which is a waste of time and space, why bother?

Accedi per commentare.

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by