Skip to content

Instantly share code, notes, and snippets.

@morganp
Created November 18, 2011 10:41
Show Gist options
  • Save morganp/1376126 to your computer and use it in GitHub Desktop.
Save morganp/1376126 to your computer and use it in GitHub Desktop.
Matlab better defaults
%% Old defaults order dependent
function config_old( rx1, rx2 )
if nargin < 2 rx2 = 0; end
end
%% newer style easy to refactor, no order dependence.
function config_new( rx1, rx2 )
if not( exist('rx2') ) rx2 = 0; end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment