Cody

# Problem 42646. Matrix FUN

Solution 1040646

Submitted on 31 Oct 2016 by Stalin Samuel
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 4; y_correct = 0; assert(isequal(mat_fun(x),y_correct))

y1 = logical 0

2   Pass
x = [3 2 3 2 5 6 2 1 2]; y_correct = 3; assert(isequal(mat_fun(x),y_correct))

y1 = 1×9 logical array 1 0 1 0 0 1 0 0 0

3   Pass
x = [999 999 999 2 15 6]; y_correct = 5; assert(isequal(mat_fun(x),y_correct))

y1 = 1×6 logical array 1 1 1 0 1 1

4   Pass
x = 3:3:999; y_correct = 333; assert(isequal(mat_fun(x),y_correct))

y1 = 1×333 logical array Columns 1 through 24 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 25 through 48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 49 through 72 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 73 through 96 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 97 through 120 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 121 through 144 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 145 through 168 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 169 through 192 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 193 through 216 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 217 through 240 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 241 through 264 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 265 through 288 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 289 through 312 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 313 through 333 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

5   Pass
x = [1 2 3 4 5 6;6 5 4 3 2 1]; y_correct = 4; assert(isequal(mat_fun(x),y_correct))

y1 = 2×6 logical array 0 0 1 0 0 1 1 0 0 1 0 0

6   Pass
x = [7 8 11 13 14 17]; y_correct = 0; assert(isequal(mat_fun(x),y_correct))

y1 = 1×6 logical array 0 0 0 0 0 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!