MATLAB: An unexpected error has occurred

MATLAB

Trying to do almost anything in MATLAB causes an error
An unexpected error has occurred.
This includes:
>> 2*2
>> z=2

Best Answer

Execute the following commands in a local folder such as the Desktop:
>> restoredefaultpath
>> rehash toolboxcache
If this resolves the issue, execute:
>> savepath
NOTE: This will remove any custom paths you may have created. If desired, please see the following link for how to back them up: