2024a seems to have a graphics bug

16 views (last 30 days)
Jon Sporring
Jon Sporring on 9 Aug 2024
Answered: Steven Lord on 9 Aug 2024
A fresh install, on a macbook with the Apple M1 chip, and a total deletion of the ~/Library/Application\ Support/MathWorks files on Macos 14.6.1, when the first command is
close all
I get the following worring error:
>> close all
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:minrhs
Not enough input arguments.
> In hgrc (line 154)
In matlab.graphics.internal.initialize (line 15)
>> plot(rand(1,10),rand(1,10))
>> close all
>> close all
>>
However, as can be seen, everything is fine once a plot has been made.
Best, Jon

Answers (1)

Steven Lord
Steven Lord on 9 Aug 2024
That suggests to me that you have defined or downloaded a function that shadows one of the built-in functions used inside hgrc.m. If we look at line 154 of hgrc.m and its neighbors:
dbtype 150:160 hgrc.m
150 clear startup_exists 151 end 152 153 catch exc 154 warning(message('MATLAB:matlabrc:InitHandleGraphics', exc.identifier, exc.message)); 155 end
we see that it's executed when some code in the try section of the try / catch block throws an error.
Try editing hgrc.m located here (replace MATLABROOT with the root directory of your installation)
replace(string(which('-all','hgrc')), matlabroot, "MATLABROOT")
ans = "MATLABROOT/toolbox/matlab/graphics/hg/hgrc.m"
and add a keyboard statement right after the try keyword (on the next line after it) at the start of hgrc.m. Then run the steps that reproduce the warning. When MATLAB enters debug mode (the K>> prompt) step through using the debugging tools in MATLAB to determine which line in hgrc.m throws the error. Use which to check the functions being called on that line to make sure the MATLAB functions aren't being shadowed; for example if it's throwing the error from the floor function calls on line 46:
dbtype 46 hgrc.m
46 left = floor(left); bottom = floor(bottom);
check that you don't have a floor.m that conflicts with the built-in floor function.
which -all floor
built-in (/MATLAB/toolbox/matlab/elfun/@char/floor) % char method built-in (/MATLAB/toolbox/matlab/elfun/@double/floor) % double method built-in (/MATLAB/toolbox/matlab/elfun/@int16/floor) % int16 method built-in (/MATLAB/toolbox/matlab/elfun/@int32/floor) % int32 method built-in (/MATLAB/toolbox/matlab/elfun/@int64/floor) % int64 method built-in (/MATLAB/toolbox/matlab/elfun/@int8/floor) % int8 method built-in (/MATLAB/toolbox/matlab/elfun/@logical/floor) % logical method built-in (/MATLAB/toolbox/matlab/elfun/@single/floor) % single method built-in (/MATLAB/toolbox/matlab/elfun/@uint16/floor) % uint16 method built-in (/MATLAB/toolbox/matlab/elfun/@uint32/floor) % uint32 method built-in (/MATLAB/toolbox/matlab/elfun/@uint64/floor) % uint64 method built-in (/MATLAB/toolbox/matlab/elfun/@uint8/floor) % uint8 method /MATLAB/toolbox/matlab/datatypes/tabular/@tabular/floor.m % tabular method /MATLAB/toolbox/matlab/datatypes/datetime/@datetime/datetime.m % datetime method /MATLAB/toolbox/matlab/datatypes/duration/@duration/floor.m % duration method floor is a built-in method % matlab.internal.capability.Capability method floor is a built-in method % connector.internal.LoggerLevel method floor is a built-in method % matlab.lang.OnOffSwitchState method floor is a built-in method % matlab.internal.reference.property.RefEntityType method floor is a built-in method % matlab.internal.reference.api.EntityPrecision method floor is a built-in method % matlab.internal.reference.property.DeprecationStatus method floor is a built-in method % matlab.internal.reference.property.FunctionType method floor is a built-in method % matlab.internal.reference.property.SyntaxType method floor is a built-in method % matlab.internal.reference.api.EntityCaseSensitivity method floor is a built-in method % simulink.FindSystemTask.Status method floor is a built-in method % mf.zero.meta.Language method floor is a built-in method % dig.config.CommandType method floor is a built-in method % dig.config.HorizontalAlignment method floor is a built-in method % dig.config.ResourceState method floor is a built-in method % dig.config.ResourceType method floor is a built-in method % dig.model.DisplayState method floor is a built-in method % dig.model.EventDataType method floor is a built-in method % dig.model.FunctionType method floor is a built-in method % dig.model.ValidInBdType method floor is a built-in method % dig.model.ViewMode method floor is a built-in method % matlab.unittest.internal.fixtures.FolderScope method floor is a built-in method % matlab.automation.Verbosity method floor is a built-in method % matlab.internal.timer.CallBackTypeEnum method floor is a built-in method % matlab.internal.timer.BusyModeEnum method floor is a built-in method % matlab.internal.timer.ExecutionModeEnum method /MATLAB/toolbox/matlab/bigdata/@tall/floor.m % tall method built-in % gpuArray method /MATLAB/toolbox/nnet/deep/@dlarray/floor.m % dlarray method /MATLAB/toolbox/parallel/array/distributed/@codistributed/floor.m % codistributed method /MATLAB/toolbox/parallel/gpu/gpu/@gpuArray/floor.m % gpuArray method /MATLAB/toolbox/symbolic/symbolic/@sym/floor.m % sym method
Once you've finished your debugging, go back to hgrc.m and remove the keyboard call since you don't want MATLAB to enter debug mode in that file every time you restart it.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!