www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/AddOptionalInputExample.m

    %% Add Optional Input  
% Create an |inputParser| object and add an optional input named |myinput|
% with a default value of |0| to the input scheme.   

% Copyright 2015 The MathWorks, Inc.


%%  
p = inputParser;
argName = 'myinput';
default = 0;
addOptional(p,argName,default);