I am looking for a workaround for the following problem:
- Create a script
foo.mcontainingfun = @(x)(x*x) - Run
foo. This creates the variablefun. - Delete
foo.m - Try running
fun(2).
In recent versions of MATLAB (I am using R2019b) this results in an error:
Previously accessible file "foo.m" is now inaccessible.
Somehow, the anonymous function is tied to the file in which it was defined.
Is it possible to somehow "detach" it so that it would continue working even after the file was deleted?
For those curious why I need this, it is for fixing MATLink, the Mathematica/MATLAB interface, for recent versions of MATLAB.