Warning: Initializing MATLAB Graphics failed.

77 次查看(过去 30 天)
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 个评论
Martin Laurenzis
Martin Laurenzis 2020-11-23
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
tkazik 2021-1-19
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.

请先登录,再进行评论。

回答(1 个)

Jim Svensson
Jim Svensson 2021-2-25
I have this problem. When can we expect an official fix?

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by