Warning: Initializing MATLAB Graphics failed.
Mostrar comentarios más antiguos
Hello,
I installed MATLAB 2020b on Ubuntu 20.04 LTS. Everytime when I start matlab I get the following warning:
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:badsubscript
Index exceeds the number of array elements (0).
> In hgrc (line 165)
In matlab.graphics.internal.initialize (line 15)
Does anyone have an idea how to fix that?
10 comentarios
Marko Vejnovic
el 26 de Oct. de 2020
I have the same error. I'm running latest Arch, Matlab 2020b.
This likely indicates a graphics driver issue. I have not yet managed to resolve it.
The Arch Wiki states that you should make sure you have the correct drivers installed. Which GPU (or iGPU) are you using? Do you have the appropriate drivers installed? Finally, do you have glu installed?
Also, this only happens for me when I'm forcing the use of i965 rather than the default i915 (in which case I get far severe errors).
If I find more about the issue I will update you.
Steradiant
el 26 de Oct. de 2020
Ben Romarowski
el 26 de Oct. de 2020
I have the same error. Looking for a fix as well
Babak Badnava
el 26 de Oct. de 2020
I have the same problem. Last week, I had no problem running my code, now whenever I use a line of code related to deep learning toolbox, MATLAB crashes, and the whole computer hangs. The only change to my display driver that I made was that I upgraded my CUDA to 10.1.
Do you think this is because of the CUDA upgrade?
Volker Brichzin
el 1 de Nov. de 2020
I have the same error and am also looking for a fix. Or to hear that it's no issue.
Btw, didn't have this error in R2020a with the same CUDA version.
tkazik
el 6 de Nov. de 2020
Same issue for me and thus subscribing to updates here.
I tried to remove the settings directory, as that seemed to help in some other cases:
rm -r /home/USER/.matlab/R2020b
But it did not help in my case. Thx for any updates!
Hannes Gorges
el 13 de Nov. de 2020
Editada: Hannes Gorges
el 13 de Nov. de 2020
After encountering the same issue, I contacted the support and they provided me with the following solution which solved the issue for me. The support suggested to point out that this is a known bug.
It appears that graphics initialization code (C++) evaluates the "matlab.graphics.internal.initialize.m" and initialize.m calls builtin('groot') in line 15 which triggers a series of C++ initialization code in "HGAPP.cpp" which in turn calls "hgrc.m". Based on this assumption, can you click on "hgrc" inside the warning message and compare the following code snippet with the lines 17-21 in "hgrc.m":
screenPos = get(groot, 'MonitorPositions');
% Get the screen positioned at [1 1]
screen = screenPos(and(screenPos(:,1)==1,screenPos(:,2)==1),:);
width = screen(3);
height = screen(4);
If the lines in your "hgrc.m" corresponds to the above code snippet, could you replace these lines by the following code snippet and save the M-File:
screen = get(groot, 'ScreenSize');
width = screen(3) - screen(1);
height = screen(4) - screen(2);
After that, close MATLAB, start it again and check, if the error message still exists.
Bruno Luong
el 13 de Nov. de 2020
Editada: Bruno Luong
el 13 de Nov. de 2020
Don't know if it's much matter but width/heigh returned by the first code has +1 more pixel than the second code.
So it should be more correct with this modification.
screen = get(groot, 'ScreenSize');
width = screen(3) - screen(1) + 1;
height = screen(4) - screen(2) + 1;
If there is any authority person TMW who reads this and follows the enentual bug fix for future MATLAB update, please make sure the right formula is implemented.
Martin Laurenzis
el 23 de Nov. de 2020
Hi,
I solved my problem by editing hgrc.m lines:
screenPos = get(groot, 'MonitorPositions');
% Get the screen positioned at [1 1]
screenPos(:,1)=1;
screenPos(:,2)=1;
screen = screenPos(and(screenPos(:,1)==1,screenPos(:,2)==1),:);
width = screen(3);
height = screen(4);
The sceenPos line returns:
>> screenPos = get(groot, 'MonitorPositions')
screenPos =
2561 1 2560 1440
1 -31 2560 1440
Then:
screen = screenPos(and(screenPos(:,1)==1,screenPos(:,2)==1),:)
screen =
0×4 empty double matrix
By setting
screenPos(:,1)=1;
screenPos(:,2)=1;
"screen" turns to:
screen = screenPos(and(screenPos(:,1)==1,screenPos(:,2)==1),:)
screen =
1 1 2560 1440
1 1 2560 1440
I also fixed my OpenGL problems by updating driver for NVIDIA GTX1080TI.
Thanks, Martin
tkazik
el 19 de En. de 2021
Unfortunately, this is still not solved with the third update of 2020b. The suggestions by @Hannes Gorges with the corrections by @Bruno Luong seem to work and this issue seems to be related to a setup with multiple monitors (apparently some negative indices by the display layout are creating trouble). So I guess the current suggestion does the job, but is still not 100% correct, given that:
% this returns only the 'layout' of the first monitor (size: 1x4)
screen = get(groot, 'ScreenSize');
% returns the full 'layout' of dual monitor (size: 2x4)
screenPos = get(groot, 'MonitorPositions');
So the proper fix will likely have to use the second cmd.
Respuestas (1)
Jim Svensson
el 25 de Feb. de 2021
2 votos
I have this problem. When can we expect an official fix?
Categorías
Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!