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))
|
Project Euler: Problem 3, Largest prime factor
379 Solvers
199 Solvers
Return the first and last character of a string
3447 Solvers
Set some matrix elements to zero
290 Solvers
Set the array elements whose value is 13 to 0
935 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!