function swap4 (a,b)
if nargin ~=2
    error('swap1 requires two arguments')
end
disp('my initial variables'); who
disp('caller''s initial variables');
evalin('caller','who'); % need quotes to delay evaluation
disp({'before', a,b});
temp=b;
assignin('caller',b,a)
assignin('caller',a,temp)
disp({'after', a,b});
disp('my variables after swap'); who
disp('caller''s final variables');
evalin('caller','who')
disp('Returning from swap4')