This error usually occurs when there are shadowed files in your system. A shadowed file is another file with same name as the primary file.
Please follow the steps mentioned below to resolve the issue :
1. Please execute the following command in the MATLAB command window and see if there are any shadowed files for pathdef.m'
>> which -all pathdef.m
See if 'pathdef.m' is shadowed by any other files. For example, if pathdef.m is shadowed, it looks as below
\\fs-57-ah\vmgr$\home07\<username>\Documents\MATLAB\pathdef.m
C:\Program Files\MATLAB\R2017a\toolbox\local\pathdef.m % Shadowed
Here 'pathdef.m' in 'toolbox\local\' is shadowed by another file with same name in 'Documents\MATLAB'.
2. Delete the file that does not have '% Shadowed' as the comment.
3. Restart MATLAB and see if the issue is resolved.
If the issue is still occurring, please execute the script 'whichall.m'. This generates an output file 'whichalloutput.txt' which contains all the files and those that are shadowing them. Review the output and decide which files should be deleted. If you are using linux, use 'whichall_linux.m'