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

# Solution 123639

Submitted on 4 Aug 2012 by Ken Deeley

Correct

31Size
`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

```%%
A = [1 2; 3 4]; L = logical(eye(2));
S_correct = [1 4];
assert(isequal(columnwise_logical_sums(A, L), S_correct))
```

2
Pass

```%%
A = triu(ones(3)); L = logical(triu(ones(3)));
S_correct = 1:3;
assert(isequal(columnwise_logical_sums(A, L), S_correct))
```

3
Pass

```%%
A = repmat(1:3, 3, 1); L = [false(3,1) true(3,2)];
S_correct = [0 6 9];
assert(isequal(columnwise_logical_sums(A, L), S_correct))
```

4
Pass

```%%
A = 1:5; L = logical([0 1 0 1 0]);
S_correct = [0 2 0 4 0];
assert(isequal(columnwise_logical_sums(A, L), S_correct))
```

5
Pass

```%%
A = (1:5).'*(1:5); L = logical(diag(ones(1,4),-1));
S_correct = [2 6 12 20 0];
assert(isequal(columnwise_logical_sums(A, L), S_correct))
```