Cody

# Problem 750. Accumulate Cells

Solution 588035

Submitted on 25 Feb 2015 by goc3
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
%% assert(isequal(accumcell(@plus,{1,2,3,4},0),10)) assert(isequal(accumcell(@times,{1,2,3,4},1),24)) assert(isequal(accumcell(@times,{1,2,3,4},0),0)) M = rand(3,4,5); C = num2cell(M,1:2); assert(isequal(accumcell(@plus,C,0),sum(M,3))) assert(isequal(accumcell(@times,C,1),prod(M,3)))

a = 1 a = 3 a = 6 a = 10 a = 1 a = 2 a = 6 a = 24 a = 0 a = 0 a = 0 a = 0 a = 0.6312 0.3964 0.6085 0.3722 0.2029 0.9995 0.4215 0.6513 0.8044 0.2673 0.3859 0.8036 a = 0.6560 0.8125 0.6284 1.0673 0.5783 1.4834 0.7403 1.6118 1.5972 0.8064 1.1380 1.4633 a = 0.8933 1.3555 1.1194 1.7335 1.5476 2.4778 1.4107 1.9049 2.2905 1.2615 1.3595 1.8290 a = 1.1686 2.0506 1.8915 2.0379 2.2210 2.8211 1.8419 2.0809 2.9783 1.3823 1.6548 2.7031 a = 1.6001 2.4368 2.3387 2.7746 2.9686 3.7582 2.6273 2.3268 3.9649 1.6783 2.3132 3.2469 a = 0.6312 0.3964 0.6085 0.3722 0.2029 0.9995 0.4215 0.6513 0.8044 0.2673 0.3859 0.8036 a = 0.0156 0.1649 0.0121 0.2587 0.0762 0.4836 0.1344 0.6256 0.6377 0.1441 0.2902 0.5301 a = 0.0037 0.0896 0.0059 0.1724 0.0738 0.4809 0.0901 0.1834 0.4422 0.0656 0.0643 0.1939 a = 0.0010 0.0623 0.0046 0.0525 0.0497 0.1651 0.0388 0.0323 0.3041 0.0079 0.0190 0.1695 a = 0.0004 0.0240 0.0021 0.0387 0.0372 0.1547 0.0305 0.0079 0.3000 0.0023 0.0125 0.0922