필터 지우기
필터 지우기

Passing named arguments to a standalone executable

조회 수: 4 (최근 30일)
chris
chris 2022년 12월 20일
답변: chris 2022년 12월 21일
Hi,
I am using Function Argument Validation - MATLAB & Simulink (mathworks.com) for a function input with named input (see example below). Now, I want to compile that function to a standalone executable and call it from the command line. Passing positional arguments works fine but how can I pass a named argument (like "namedArg1")?
function test(arg1, arg2, opts)
arguments
arg1 string
arg2 string = "arg2Val"
opts.namedArg1 string = "msg"
end
disp(opts.namedArg1)
end
I tried calling the executable like:
test.exe "abc" namedArg1="tstMsg"
but that doesn't work.

채택된 답변

chris
chris 2022년 12월 21일
Turns out it works if you call it like this:
test.exe "abc" "namedArg1" "tstMsg"
I just had a bug in my original function when I tested it but this works.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by