optset.m
来自「GMM工具箱」· M 代码 · 共 27 行
M
27 行
% OPTSET Utility to set function options
% USAGE
% optset(funcname,optname,optvalue)
% INPUTS
% funcname : name of function
% optname : name of option
% optval : option value
%
% If optname='defaults' the current setting of the options will be
% cleared. The next time the function is called, the default
% options will be restored.
% Copyright (c) 1997-2002, Paul L. Fackler & Mario J. Miranda
% paul_fackler@ncsu.edu, miranda.4@osu.edu
function optset(funcname,optname,optvalue)
optvar = [lower(funcname) '_options']; % name of global variable
optname = lower(optname); % name of option field
if strcmp(optname,'defaults')
eval(['clear global ' optvar]) % clears global variable
else
eval(['global ' optvar]) % declare global variable
eval([optvar '.' optname '=optvalue;']) % set specified field
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?