Cody

Solution 1259746

Submitted on 31 Aug 2017 by Alfonso Nieto-Castanon
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
s.f1 = 'Sunday'; s.f2 = 'Monday'; s.f3 = 'Tuesday'; s.f4 = 'Wednesday'; s.f5 = 'Thursday'; s.f6 = 'Friday'; s.f7 = 'Saturday'; f = @(x)x(1:3); c = structfun(f,s,'UniformOutput',false); assert(isequal(structfun2(f,s),c))

2   Pass
s = struct('f1',{1, [3 4;5 6]; 1, [5 6;7 8]},'f2',{[1 2], 2; [3 4 5;6 7 8], [2 6;4 5]}); f = @min; c = struct('f1',{1, [3 4]; 1, [5 6]},'f2',{1, 2; [3 4 5], [2 5]}); assert(isequal(structfun2(f,s),c))

3   Pass
s = struct('f1',{1, [3 4;5 6]; 1, [5 6;7 8]},'f2',{[1 2], 2; [3 4 5;6 7 8], [2 6;4 5]}); f = @sum; c = struct('f1',{1, [8 10]; 1, [12 14]},'f2',{3, 2; [9 11 13], [6 11]}); assert(isequal(structfun2(f,s),c))

4   Pass
s = struct('f1',{1, [3 4;5 6]; 1, [5 6;7 8]},'f2',{[1 2], 2; [3 4 5;6 7 8], [2 6;4 5]}); f = @pow2; c = struct('f1',{2, [8 16;32 64]; 2, [32 64;128 256]},'f2',{[2 4], 4; [8 16 32;64 128 256], [4 64;16 32]}); assert(isequal(structfun2(f,s),c))