Checks for all variables and functions in the file(s) whether they shadow any existing functionality. For example: if a variable named pi is defined, you will no longer have access to the actual value of within that file. This can cause unexpected and undesired behaviour. Variables and functions are reported if they have the same name as one or more of the following:

  • MATLAB-installed functions. As described here, certain method names are supposed to overload MATLAB-installed functions. When used as the right type of method, these are ignored by this check, regardless of whether or not they are configured as exceptions.

  • Classes

  • Packages

  • MATLAB executable files (MEX): .mexw32, .mexw64, .mexa64, .mexmaci64

  • Simulink files: .mdl, .slx. Detecting the shadowing of a Simulink file requires a Simulink license.

  • Other MATLAB files: .m, .mlx, .mlapp, .p

Configurable parameters

  • Exceptions (list): A list of names that do not need to be checked for shadowing. Add names to this list if you want to shadow certain files/functions or if you do not mind shadowing specific files. Suggestions for exceptions include input/output-related functions: nargin, nargout, varargin and varargout.

Exemption tag: %@ok<NSHAD>