Cody

Solution 678583

Submitted on 1 Jun 2015 by James
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.2214 0.2923 0.8983 0.1741 0.9372 0.7736 0.3477 0.4579 0.6987 0.9261 0.2930 0.7072 a = 1.2133 0.3650 1.0936 0.2400 1.1485 1.4495 0.3924 0.6486 1.0021 1.8654 0.8876 1.0700 a = 1.8348 0.9154 1.1988 0.5658 1.4273 2.3172 1.1331 0.7846 1.1793 2.7649 1.2345 1.2257 a = 1.9310 1.0408 2.1041 1.4335 1.5509 2.3340 1.5258 1.6985 1.2830 3.0799 2.0903 1.9033 a = 2.3839 1.5545 2.1471 2.1168 2.2914 2.7574 1.6599 2.6510 1.3807 3.9530 2.6663 2.3425 a = 0.2214 0.2923 0.8983 0.1741 0.9372 0.7736 0.3477 0.4579 0.6987 0.9261 0.2930 0.7072 a = 0.2196 0.0213 0.1754 0.0115 0.1981 0.5229 0.0156 0.0873 0.2120 0.8699 0.1742 0.2566 a = 0.1365 0.0117 0.0185 0.0037 0.0552 0.4537 0.0115 0.0119 0.0376 0.7824 0.0604 0.0399 a = 0.0131 0.0015 0.0167 0.0032 0.0068 0.0076 0.0045 0.0109 0.0039 0.2465 0.0517 0.0271 a = 0.0059 0.0008 0.0007 0.0022 0.0051 0.0032 0.0006 0.0103 0.0004 0.2152 0.0298 0.0119

Suggested Problems

More from this Author11