view general/funutils/flip.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents e44f49929e56
children fbc0540a9208
line wrap: on
line source
function g=flip(f)
% flip - Flip order of first two arguments to a function
%
% flip :: (A,B->C) -> (B,A->C).

if isa(f,'func'), 
	g=perm(f,[2,1]);
else
	if nargin(f)==2, f=@(a,b)f(b,a);
	else f=@(a,b,varargin)f(b,a,varargin{:});
	end
end