MATLAB Community

MATLAB, community & more

Function Name Case Sensitivity in MATLAB R2011b

I can barely remember a MATLAB version that did not produce an inexact case match warning if you used the wrong capitalization of a function name. Now, the days of willy-nilly capitalization in MATLAB are over. Starting in R2011b, that long-time warning is now an error.

Here is the warning message in R2010a by calling “foo.m” with the command “Foo“:

Warning: Could not find an exact (case-sensitive) match for 'Foo'.
../foo.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
This warning will become an error in future releases. 

As promised, R2011b is the future release where this is now an error:

Cannot find an exact (case-sensitive) match for 'Foo'.
Do you want: foo
(in ../foo.m)?

This error identifier for this message is the same as the old warning: 'MATLAB:dispatcher:InexactCaseMatch'. If you still have any misspelled functions in your code, they should be spot by running the code and looking for these errors. Before launching your main script, run the command:

dbstop if error MATLAB:dispatcher:InexactCaseMatch

and your program will pause whenever this error occurs.

  • print


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。