function [a,b]=sampfunc(x,y) %Always include some comment lines!! (Don't need to include this one) %function [a,b]=sampfunc(x,y) % This is a template function file. There are two inputs % x and y, and two outputs a, b. % If you only have one output, you can write: a=sampfunc(x,y) %In this example, my function just swaps x and y a=y; b=x;