-
Notifications
You must be signed in to change notification settings - Fork 0
opts_to_args.m
Calvin Eiber edited this page Jul 7, 2021
·
2 revisions
ViNERS was developed using a consistent 'name',value
syntax for controlling the behaviour of most of the modules in +models, +plots, and +tools.
Tools.opts_to_args
extends this syntax by enabling model modules to accept arguments in the form of an options structure.
tools.opts_to_args
is part of package +tools
%% Example 1: name,value syntax
models.axon_sfap( '-file', eidors_file, '-axons', axons_file )
%% Example 2: options structure
options.sfap.file = eidors_file;
options.sfap.axons = axons_file;
models.axon_sfap( options )
%% Example 3: cell argument syntax
options.sfap = {'-file', eidors_file, '-axons', axons_file }
models.axon_sfap( options )
% equivalent to models.axon_sfap( options.sfap{:} )
%% Example 4: hybrid syntax
options = struct;
options.sfap.file = eidors_file;
models.axon_sfap( options, '-axons', axons_file )
% This will also work with cell argument syntax
If an argument is supplied in multiple places, the commandline input will take precedence over the options structure unless the flag --s2a-first
is an input argument.
NOTE: an options structure field of the form options.field = true
will get translated to an input argument of '-field'
(no value
), and an options structure field of the form options.field = false
will skipped entirely.