MATLAB: How to fix MATLAB errors arise from changing the search path

MATLABmatlab coderMATLAB Compilermatlab functionmatlab gui

The Matlab software installed on my computer(windows OS) shows a lot of errors when I tried to change the search path by using addpath command , suddenly MATLAB shows errors even for the startup and doesn't recognize any functions or variables or any commands
I usually saved my projects in C:\Program Files\MATLAB\R2016a\bin and when I tried to change the search path to C:\Users\Bita\Documents\MATLAB by using
addpath('newpath')
and also usnig
mypath=fullfile(userpath,'foldername')
addpath(mypath)
and then MATLAB is showing iterative errors while I'm not running any programs, even for MATLAB startup ,It shows a lot of errors
The errors are:
Undefined function or variable 'matlabrc'.
Undefined function or variable 'which'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable 'rmiml.getAll'.
Undefined function or variable 'fschange'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Undefined function or variable
'internal.matlab.desktop.editor.isSystemObjectFile'.
Undefined function or variable 'rmiml.visibleInToolstrip'.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.mathworks.mlwidgets.graphics.ModelStateFactory.createNoSelectionModelState(ModelStateFactory.java:251)
at com.mathworks.mlwidgets.graphics.PlotToolSetFactory$3.parseComplete(PlotToolSetFactory.java:123)
at com.mathworks.mlwidgets.graphics.ModelStateFactory$ProductInfoListener$1$1.run(ModelStateFactory.java:1032)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I'll be very grateful to have your opinions about how to fix MATLAB software
Thanks

Best Answer

"I usually saved my projects in C:\Program Files\MATLAB\R2016a\bin"
You have corrupted MATLAB . You need to move your projects somewhere else for the moment, then uninstall MATLAB and reinstall it. Then after that, you need to never save your MATLAB files underneath C:\Program Files
Related Question