Error is showing: "Error using plot: Unrecognized function or variable 'matlab.graphics.chart.internal.inputparsinutils.prepareAxes'"
Show older comments
I have installed MATLAB R2025b last week, and could not open Simulink, receiving the error that it cannot find "MATLAB/R2025b/toolbox/matlab/graphics/core/hg/hgrc.m". I have therefore added the path for that function to the path, and now suddenly, the function "plot" (outside of simulink) does not work anymore, giving the following errors:
Unrecognized function or variable 'matlab.graphics.internal.initialize'
and
Unrecognized function or variable 'matlab.graphics.chart.internal.inputparsingutils.prepareAxes'
In any case, the added path is not in the path anymore after restarting MATLAB. So this cannot actually be the reason.
How can I solve this problem?
Thanks for your help!
2 Comments
dpb
on 19 Mar 2026 at 16:31
Contact Mathworks at <Product Support Page>. They support install and startup issues. Something went wrong initially or the default path wouldn't have needed munging on...
I have therefore added the path for that function to the path
Can you show the exact command you used to add the folder to the path, and any text (particularly text in orange) that the command displayed when you ran it? Perhaps that command inadvertently removed a folder from the path.
That folder ought to have been on the MATLAB path anyway, so you shouldn't have needed to add it. You can see that in MATLAB Online it is on the path (I haven't done any other path manipulation in this comment.)
P = split(path, pathsep);
hgdir = fullfile('toolbox','matlab','graphics','core','hg');
isItOnThePath = P(contains(P, hgdir))
When I run the command in a freshly started session of my Windows desktop installation (where again I haven't done any path manipulation) the output is:
isItOnThePath =
{'C:\Program Files\MATLAB\R2025b\toolbox\matlab\graphics\core\hg'}
Answers (1)
Soumya
about 3 hours ago
Hi Jana,
To help resolve the issue you are experiencing, I recommend trying the following steps:
1. Uninstall and Reinstall MATLAB: Please uninstall MATLAB from your system and then perform a fresh installation. This will ensure that none of the MATLAB files are corrupted and will give you a clean setup.
2. Test Your Workflow: After reinstalling, try running your workflow again to see if the issue persists.
3. Reset MATLAB Path (if needed): If the problem continues, please enter the following commands in the MATLAB command window:
restoredefaultpath
rehash toolboxcache
savepath
I hope these steps will help resolve the issue.
Sincerely,
Soumya
1 Comment
Stephen23
10 minutes ago
You might as well start with 3 first, before reinstalling.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!