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

5 visualizaciones (últimos 30 días)
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 comentarios
Alec Jacobson
Alec Jacobson el 19 de Ag. de 2020
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.
Alec Jacobson
Alec Jacobson el 20 de Ag. de 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).

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 19 de Ag. de 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 comentarios
Steven Lord
Steven Lord el 19 de Ag. de 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.
Alec Jacobson
Alec Jacobson el 19 de Ag. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by