There's an old 2013 question (https://www.mathworks.com/matlabcentral/answers/106531-how-to-get-matlab-to-reload-an-m-file) related to this. The answer back then suggests that MATLAB is not checking for changes. However, up until 2020a, this has never been an issue for me, so something new has changed with 2020b. I'm hoping this can be reverted. Issuing clear myscript before every call is not feasible, especially with large projects with subroutines upon subroutines.
MATLAB 2020b does not reload .m file edited outside of matlab until after running
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Steven Lord
le 19 Août 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 commentaires
Steven Lord
le 19 Août 2020
The answer is not as simple as yes or no, as you can see from the fact that there is a documentation page on the subject for Windows as well as one that described caching of files on the MATLAB path (which is one reason we recommend users not put files in directories under matlabroot.) You should probably provide details about your configuration (OS, which I suspect from your comment is macOS, as well as whether you're putting these files on a local or network drive) to Technical Support.
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!