Search code examples
matlabbuilt-inreserved-wordsredefine

Is it possible to prevent matlab from defining variables which overwrite function names?


From time to time I have this problem with Matlab where I for example, create a variable named "max" and then get all kinds of weird errors when I try to use the function max() on something, since I overwrote the function by accident with my variable.

I have lost much time and my mind, and I find it awful that this is even possible.

I would like to know if there is a way to disable this behavior, so that function names are reserved like in many other languages and this cannot happen by mistake.


Solution

  • From the looks of the documentation, you can't do that.

    You should use exist <name> when in doubt to make sure that <name> won't override an existing function.