Explanation

MATLAB enforces a nesting limit of 15 for functions. This message appears when one or more of the following is true:

In the first two cases, additional messages might indicate where the extra end is. Code Analyzer indicates keywords that do not align with their matching end keywords.


Suggested Action

If the message is due to mixing function keywords with and without corresponding end statements, fix the function style to be consistent. If there are extra end statements in the file by mistake, remove them. If you want more than 16 levels of nesting, consider using the MATLAB class system. Often the function nesting level drops and the code becomes simpler to understand when you use classes instead of nested functions.