inputParser: How can defaults of argument x,y,... be dependent on argument a,b,...
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Say I have a function foo(X,varargin) which can do either A (X=A) or B (X=B).
If it does A then varargin should be a number of arguments, say x1, x2,.... that has certain default values (x1 = a1, x2 = a2,...), but if it does B the arguments x1, x2,.... then has other certain default values (x1 = b1, x2 = b2,...).
After initialising the p.inputParser, one uses several p.addParamValue's to check argument sanity and adds default values. Finally the arguments are compiled with p.parse(X,varargin).
In this setup how does one switch which default values to use in p.addParamValue? Put differently: Since the input arguments are not parsed until the end, how can one make a switch between (a1,a2,...) and (b1,b2,...) for X being A or B, respectively.
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Argument Definitions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!