function swap(x, y) % swap -- Swap two variables. % swap(x, y) swaps variables x and y in the % caller's workspace, where they must have % actual names. Note: no output arguments. % Copyright (C) 1998 Dr. Charles R. Denham, ZYDECO. % All Rights Reserved. % Disclosure without explicit written consent from the % copyright owner does not constitute publication. % Version of 12-Nov-1998 15:21:41. if nargin < 2, help(mfilename), return, end assignin('caller', inputname(1), y) assignin('caller', inputname(2), x)