How to acces the value of a Optional-Positional argument (~ argument) ?

1 回表示 (過去 30 日間)
D D
D D 2022 年 3 月 9 日
編集済み: Matt J 2022 年 3 月 9 日
I want a function like this:
function foo(a, b, ~)
foo2(a, b, ~) % two ~ are same
end
However it's not allowed. So how to access the value of ~, or find another way to pass it to foo2?

採用された回答

Matt J
Matt J 2022 年 3 月 9 日
編集済み: Matt J 2022 年 3 月 9 日
The ~ doesn't mean the input is optional. It means the function doesn't care what it is. Since your function does care, use a named argument.
function foo(a, b, c)
foo2(a, b, c)
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by