What is the difference between addOptional and addParamValue when using the inputParser class?

2 ビュー (過去 30 日間)
Paul
Paul 2013 年 6 月 14 日
回答済み: Robert Moss 2015 年 4 月 15 日
Hello,
I am writing a function that takes in additional optional inputs using the inputParser class, and I am unsure if I should be using addOptional or addParamValue. Based on the documentation, I'm not sure that I understand the difference between the two. Can anyone please explain?
Thanks.

回答 (1 件)

Robert Moss
Robert Moss 2015 年 4 月 15 日
As near as I can tell the difference between addOptional and addParamValue is that addOptional, like addRequired, is a POSITIONAL input, and cannot be added to the function call in arbitrary order as you can with addParamValue. In other words, it's not a name/value pair.

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by