MATLAB: How to disable the case-sensitivity match checking feature in MATLAB

MATLAB

There is a feature in MATLAB 7.1 (R14SP3) which checks for a case-sensitive match for the variable or function name and uses an incorrect case for the function if it finds one. For instance, I have a variable named "Depth" in my file which does not get created because of a failed IF condition and so now MATLAB 7.1 (R14SP3) picks up a function on my path with name "depth" instead of erroring out saying the variable does not exist.
I get the following warning message at the MATLAB command prompt:
Warning: Could not find an exact (case-sensitive) match for 'Depth'.
/mnt/D/matlab/functions/Oceans/depth.m is a case-insensitive match and
will be used instead.
You can improve the performance of your code by using exact
name matches and we therefore recommend that you update your
usage accordingly. Alternatively, you can disable this warning using
warning('off','MATLAB:dispatcher:InexactMatch').
I want this case-sensitivity checking feature to be disabled and instead generate an error message saying the function/variable does not exist.

Best Answer

This feature has been added as a requirement in product MATLAB 7.13 R2011b.
There are two ways to work around this error:
1. Change all references which have the incorrect case to have the proper case.
2. Write wrapper functions which are named with the incorrect case and call the correct function from within them.
If you are using a previous version, read the following:
In order to turn this warning message into an error message so that MATLAB does not pick the alternative function (wrong case function) but errors out, use the following command at the MATLAB command prompt:
warning error MATLAB:dispatcher:InexactMatch
Note that this is not recommended as might cause some internal toolbox functions to malfunction. This might cause some memory leaks and result in segmentation violation errors. Therefore even if you make the warning into an error message, it is recommended that you revert back to warning state in a fresh session of MATLAB. You can do that by using the following command at the MATLAB command prompt:
warning('on','MATLAB:dispatcher:InexactMatch');