23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4 M-File <strong>Programming</strong><br />

Property<br />

FunctionName<br />

KeepUnmatched<br />

StructExpand<br />

Description<br />

Function name to be included in error messages.<br />

Defaults to an empty string.<br />

Enable or disable errors on unmatched<br />

arguments. Defaults to false.<br />

Enable or disable passing arguments in a<br />

structure. Defaults to true.<br />

Summary of inputParser Properties that Provide Information<br />

Property<br />

Parameters<br />

Results<br />

Unmatched<br />

UsingDefaults<br />

Description<br />

Names of arguments defined in inputParser<br />

schema.<br />

Names and values of arguments passed in<br />

function call that are in the schema for this<br />

function.<br />

Names and values of arguments passed in<br />

function call that are not in the schema for this<br />

function.<br />

Names of arguments not passed in function call<br />

that are given default values.<br />

Passing Optional Arguments to Nested Functions<br />

You can use optional input and output arguments with nested functions,<br />

but you should be aware of how <strong>MATLAB</strong> interprets varargin, varargout,<br />

nargin, andnargout under those circumstances.<br />

varargin and varargout are variables and, as such, they follow exactly the<br />

same scoping rules as any other <strong>MATLAB</strong> variable. Because nested functions<br />

share the workspaces of all outer functions, varargin and varargout used in<br />

a nested function can refer to optional arguments passed to or from the nested<br />

function, or passed to or from one of its outer functions.<br />

4-48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!