Cody

Solution 400630

Submitted on 11 Feb 2014 by J-G van der Toorn
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
%% [a,b,c,d,e]=deal(1,2,3,[1 2 3],rand(5)); fun=@(X)X; [f,g,h,i,j]=dealfun(fun,a,b,c,d,e); assert(isequal({f g h i j},{a,b,c,d,e}))
2   Pass
%% [a,b,c,d,e]=dealfun(@numel,ones(3),{1 2 3 4},'four',[],5); assert(isequal({d e b c a},{0 1 4 4 9}))
3   Pass
%% A=[0 1 1 ; 1 1 0; 0 0 1]; [r,c]=meshgrid(1:3); [r,c]=dealfun(@(X)nonzeros(X.*A),r,c); assert(isequal([c,r],[2 1; 1 2; 2 2; 1 3; 3 3]))
4   Pass
%% a=5; b=6; c=[7 8]; [a,b,c]=dealfun(@(X)times(X{:}),{b c},{c a},{a b}); assert(isequal(a,[42 48])) assert(isequal(b,[35 40])) assert(isequal(c,30))