MATLAB Answers

MATLAB 2020b does not reload .m file edited outside of matlab until after running

7 views (last 30 days)
Alec Jacobson
Alec Jacobson on 19 Aug 2020
Commented: Alec Jacobson on 20 Aug 2020
I typically edit .m files outside of the matlab ide (using vim). Up until 2020b this was never an issue. In 2020b, if I make a change to a script or function, then the next time I run it in matlab it will use the old version. If I run it a second time, it will have noticed the changed file and run the new version.
To recreate this consistently:
In Terminal.app:
echo "fprintf('old version\n')" > myscript.m
In MATLAB:
myscript
displays:
old version
In Terminal.app
echo "disp('new version');" > myscript.m
In MATLAB:
myscript
displays
old version
Again in MATLAB:
myscript
displays
new version
In Terminal.app
rm myscript
In MATLAB
myscript
displays
new version
Again, in MATLAB:
myscript
displays
Unrecognized function or variable 'myscript'.
Is there a way to fix this in settings somehow? This is making 2020b almost unusable for me. Will there be an update before the official release to fix this?
  2 Comments
Alec Jacobson
Alec Jacobson on 20 Aug 2020
For other people landing here. Tech Support got back to me that this is a known issue that they're working on but might not be fixed by the 2020b general release. In the meantime, typing clear functions is supposed to reload everything (rather than clear myscript one at a time).

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 19 Aug 2020
Release R2020b has not been released yet, so I suspect you're using the Prerelease of R2020b. Please send questions or feedback on Prerelease versions to Technical Support using the telephone icon in the upper-right corner of this page instead of posting them to MATLAB Answers.
  3 Comments
Alec Jacobson
Alec Jacobson on 19 Aug 2020
Yup, mac OS and local drive on a laptop. By not putting files in matlabroot do you mean not putting them in the '/Applications/MATLAB_R2020b.app' directory? If so, then they're definitely not there. FWIW, toggle Enable toolbox path cache in general settings did not fix this issue.

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!