23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function Arguments<br />

p.parse(script, varargin{:});<br />

Save and run the function and observe text of the error message:<br />

publish_ip('ipscript.m', 'ppt', 'outputDir', 5, ...<br />

'maxWidth', 500, 'maxHeight', 300);<br />

??? Argument 'outputDir' failed validation ischar in PUBLISH_IP.<br />

Making a Copy of the Schema<br />

The createCopy method enables you to make a copy of an existing schema.<br />

Because the inputParser class uses handle semantics, you cannot make a<br />

copy of the object using an assignment statement.<br />

The following statement creates an inputParser object s that is a copy of p:<br />

s = p.createCopy<br />

Summary of inputParser Methods<br />

Method<br />

addOptional<br />

addParamValue<br />

addRequired<br />

createCopy<br />

parse<br />

Description<br />

Add an optional argument to the schema<br />

Add a parameter-value pair argument to the<br />

schema<br />

Add a required argument to the schema<br />

Create a copy of the inputParser object<br />

Parse and validate the named inputs<br />

Summary of inputParser Properties that Control Parsing<br />

Property<br />

CaseSensitivity<br />

Description<br />

Enable or disable case-sensitive matching of<br />

argument names. Defaults to false.<br />

4-47

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

Saved successfully!

Ooh no, something went wrong!