% we must begin with this kind of syntax: % % function [arg1out,arg2out,...,argNout] = fileName( arg1in, arg2in, ..., argnNin) % % so that matlab knows we want this to be a "function" % % note that when calling the function, you can capture any number of outputs % you like, e.g. % % egfunc(a,b) -- does nothing unless egfunc has side-effects, such % as writing to disk, here it does not. % % c = egfunc(a,b) -- captures first output argument only % [c,d] = egfunc(a,b) -- captures both output arguments function [c,d] = egfunc(a,b) c = a + b; % just make sure you set the output variables to something d = a - b;