Cody

# Problem 750. Accumulate Cells

Solution 96074

Submitted on 6 Jun 2012 by Vincent
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.2877 0.3275 0.7352 0.6977 0.4410 0.4446 0.0151 0.3386 0.9062 0.4795 0.0706 0.9897 a = 0.3559 1.2778 1.0219 1.2788 1.2458 0.6886 0.8347 1.1248 1.5430 0.6606 0.3232 1.5924 a = 1.3500 1.5761 1.2796 1.5259 1.6426 1.2524 1.1634 1.2522 1.8321 0.7696 0.6330 1.6274 a = 1.9696 2.2410 1.4398 1.8644 2.3823 1.3209 1.9236 2.1253 1.9466 1.6151 0.8858 2.3859 a = 2.0310 2.5509 1.7405 2.5629 3.1988 1.4399 2.2728 2.8328 2.5327 2.3270 1.1191 2.9774 a = 0.2877 0.3275 0.7352 0.6977 0.4410 0.4446 0.0151 0.3386 0.9062 0.4795 0.0706 0.9897 a = 0.0196 0.3112 0.2107 0.4055 0.3549 0.1085 0.0124 0.2662 0.5771 0.0868 0.0178 0.5965 a = 0.0195 0.0928 0.0543 0.1002 0.1408 0.0612 0.0041 0.0339 0.1668 0.0095 0.0055 0.0209 a = 0.0121 0.0617 0.0087 0.0339 0.1042 0.0042 0.0031 0.0296 0.0191 0.0080 0.0014 0.0159 a = 0.0007 0.0191 0.0026 0.0237 0.0851 0.0005 0.0011 0.0210 0.0112 0.0057 0.0003 0.0094