Created
May 3, 2012 14:37
-
-
Save ferryzhou/2586075 to your computer and use it in GitHub Desktop.
Initialize variable based on options from input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function val = init_option(options, name, default_val) | |
% usage lamda = init_option(options, 'lamda', 0.01); | |
if isfield(options, name), val = options.(name); else val = default_val; end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment