I was also experiencing this behavior when using run() to execute a script used as an input file. I found in the Matlab documentation for the run() function the reason for this:
"If a script is not on the MATLAB path, executing the run command caches the script. In the same session and after calling run, you can edit the script using an external editor. Call clear scriptname before calling run again to use the changed version of the script rather than the cached version. If you edit the script with the MATLAB editor, run executes the changed version and there is no need to call clear scriptname."
I've verified that the following works:
script = 'C:\some_path\do_stuff.m';
I tried using cd() and addpath() but was never able to get Matlab to ignore the cached copy without using clear().
Additionally, my initial workaround was eval(fileread(filepath)) which worked for my use case. This evaluates the text in the file directly without giving Matlab the chance to cache the file. Since run() calls evalin(), neither completely avoids the eval functions. I haven't done any performance testing to know which is faster or better, but the clear(), run() method looks cleaner.
I also verified that I only experienced this problem when saving with external text editors, even if I had the file up in Matlab as well (which auto-loads the externally saved version). Only if you save the file with the Matlab editor will Matlab clear it's cached copy automatically.