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

Solution 162256

Submitted on 15 Nov 2012 by José Ramón Menzinger

Correct

29Size
Leading solution size is 15.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
assert(isequal(McCabe('polyval.m'),19)); % polyval
%message: 'The McCabe complexity of 'polyval' is 19.'
a =
    message: 'The McCabe complexity of 'polyval' is 19.'
       line: 1
     column: [23 29]
        fix: 0
ans =
    19
2
Pass
 
%%
assert(isequal(McCabe('residue.m'),21));
%2x1 struct array with fields:
a =
2x1 struct array with fields:
    message
    line
    column
    fix
ans =
    21
3
Pass
 
%%
assert(isequal(McCabe('polyeig.m'),18));
a =
2x1 struct array with fields:
    message
    line
    column
    fix
ans =
    18
4
Pass
 
%%
assert(isequal(McCabe('roots.m'),7));
% message: 'The McCabe complexity of 'roots' is 7.'
a =
    message: 'The McCabe complexity of 'roots' is 7.'
       line: 1
     column: [14 18]
        fix: 0
ans =
     7
5
Pass
 
%%
assert(isequal(McCabe('decic.m'),14));
%3x1 struct array with fields:
a =
3x1 struct array with fields:
    message
    line
    column
    fix
ans =
    14