easydefaults

版本 1.3.0.0 (1.9 KB) 作者: Jared
Easy-to-use interface for supplying default values for function inputs.
394.0 次下载
更新时间 2013/1/15

查看许可证

- For input arguments x1,x2,x3, set default values x1def,x2def,x3def as a list of as parameter-value pairs using easydefaults:
easydefaults('x1',x1def,'x2',x2def,'x3',x3def);

- Defaults can be set for any input argument, whether it’s an explicit input or as part of a parameter-value pair:
function dummy_function(x,varargin)
easydefaults('x',1,'y',2);
...
end

- easydefaults and easyparse can in principle be used in either order, but it is usually better to parse first and fill in defaults after:
function dummy_function(x,varargin)
easyparse(varargin,'y')
easydefaults('x',1,'y',2);
...
end

CAVEAT UTILITOR: this function relies on evals and assignin statements. Input checking is performed to limit potential damage, but use at your own risk.

One of a series of simple functions to provide easier input parsing within MATLAB.

引用格式

Jared (2024). easydefaults (https://www.mathworks.com/matlabcentral/fileexchange/39785-easydefaults), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Argument Definitions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.3.0.0

Updated description, improved input checks.

1.2.0.0

Updated license file.

1.0.0.0