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

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Classical Control Design 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by