Quantcast

Documentation Center

  • Trial Software
  • Product Updates

createCopy

Class: inputParser

Create copy of inputParser object (to be removed)

The createCopy method will be removed in a future release. Use copy instead.

Syntax

pNew = createCopy(p)

Description

pNew = createCopy(p) creates a copy of inputParser object p.

Tips

  • Using createCopy is not the same as copying by assignment, such as pNew = p, which creates a new handle to the same object p.

Input Arguments

p

Object of class inputParser.

Output Arguments

pNew

inputParser object with the same properties as object p.

Examples

expand all

Copy Input Parser Scheme

Create a copy of an existing inputParser object, and add an optional input to the copy.

p = inputParser;
default = 0;

addRequired(p,'first');
addOptional(p,'second',default);

pNew = createCopy(p);
addOptional(pNew,'third',default);

Object p has two inputs in the scheme, first and second. Object pNew has an additional input, third.

Parse each object.

input1 = 1; input2 = 2; input3 = 3;

parse(p,input1);
p.Results
ans = 
     first: 1
    second: 0
parse(pNew,input1,input2,input3);
pNew.Results
ans = 
     first: 1
    second: 2
     third: 3

See Also

Was this topic helpful?