MATLAB: Do I see errors related to “connector” on MATLAB R2018b Startup

ensureserviceonlocationMATLABpathdefstartupwarning

Why do I see the following errors on MATLAB R2018b startup?
Warning: Location
C:\Users\username\Documents\MATLABC:\Users\username\Documents\MATLAB\pcode
specified for a File or Folder is invalid.
Undefined function or variable 'connector.ensureServiceOn'.
Undefined function or variable 'mls.internal.FevalService.init'.
Undefined function or variable 'matlab.supportpackagemanagement.internal.getInstalledSupportPackagesInfo'.
Undefined function or variable 'connector.ensureServiceOn'.
Undefined function or variable 'connector.ensureServiceOn'.
Undefined function or variable 'connector.internal.lifecycle.callConnectorStarted'.
Undefined variable "connector" or class "connector.resetLocalePreference".
 

Best Answer

A copy of "pathdef.m" is in the current workspace. Deleting this file resolves the issue. If "pathdef.m" does not exist in current workspace, please try the following  troubleshooting steps:
Execute the following command in MATLAB Command Window:
 
>> which -all pathdef
This command returns the path of "pathdef.m". By default, this file should be located in 
   
    C:\Program Files\MATLAB\R20XXx\toolbox\local\
In addition, there should be only one "pathdef.m". If the output of the above command shows you have more than one "pathdef.m", please remove all "pathdef.m" which are not in the above default path.
After removing all "pathdef.m" which are not in the above default path, please launch MATLAB again and see if the issue persists.
If there is only one "pathdef.m" in your system or removing redundant "pathdef.m" does not resolve this issue, please try (a) regenerating preferences, (b) restoring MATLAB to default paths and (c) rehashing toolboxcache:
    a) How do I regenerate my MATLAB preferences?
    b)  Restore search path to factory-installed state.
          Before modifying the search path, you can take a backup of your 'pathdef.m' file, which can be located by using the command in MATLAB Command Window
>> which -all pathdef 
          Before proceeding, you should backup this file by copying it to a folder outside of your MATLAB path.
          After making the backup, please execute the following commands in the MATLAB Command Window to restore the default MATLAB search path.
>> restoredefaultpath 
         For more information about the above command, please take a look at the following link:
   
    c) In MATLAB Command Window, execute the following command:
>> rehash toolboxcache 
    For more information about the above command, please take a look at the following link: