Cody

Problem 964. McCabe Complexity

The Challenge is to return the McCabe complexity for various functions.

One way to determine the McCabe Complexity is to use the form:

 checkcode -cyc polyval.m  

which returns: L 1 (C 23-29): The McCabe complexity of 'polyval' is 19.

Input: Function name (string)

Output: McCabe Complexity (numeric)

Example:

For 'polyval.m' the expected output is 19.

For some functions there are structures and fields which complicates finding the McCabe complexity value.

The McCabe complexity is used in the scoring of the Matlab Semi-annual contests. Complexities higher than 10 induce severe penalties.

Solution Stats

39.24% Correct | 60.76% Incorrect
Last solution submitted on May 09, 2016

Problem Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more