Cody

# Problem 42646. Matrix FUN

Solution 752088

Submitted on 3 Oct 2015 by Manish Joshi
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))

y = 0

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

y = 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))

y = 1 1 1 0 1 1

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

y = Columns 1 through 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 17 through 32 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 33 through 48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 49 through 64 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 65 through 80 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 81 through 96 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 97 through 112 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 113 through 128 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 129 through 144 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 145 through 160 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 161 through 176 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 177 through 192 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 193 through 208 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 209 through 224 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 225 through 240 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 241 through 256 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 257 through 272 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 273 through 288 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 289 through 304 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 305 through 320 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 321 through 333 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))

y = 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))

y = 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!