MATLAB:Inp​utParser:A​rgumentFai​ledValidat​ion

조회 수: 6 (최근 30일)
Shojiro SHIBAYAMA
Shojiro SHIBAYAMA 2018년 7월 10일
댓글: Steven Lord 2018년 7월 10일
I've attempted to develop an .exe software from .m file.
I want the software to have `logical` input; however, .exe file that is generated through `mcc -m *.m` does not accept logical input. It seems that the .exe on bash or sth read input as `char` input.
Now the error is raised as follows:
>> ! CliSoftware verbose true
Error using CliSoftware (line 11111)
The value of 'verbose' is invalid. It must satisfy the function: islogical.
MATLAB:InputParser:ArgumentFailedValidation
Please give me a way to allow `logical`-type input on .exe file.

채택된 답변

Guillaume
Guillaume 2018년 7월 10일
편집: Guillaume 2018년 7월 10일
I don't know about matlab specifically, but it's normal for an executable to treat all command line inputs as characters. It's normally up to you to parse the input and convert it to whatever type you want.
It's trivial to do anyway. You have plenty of options:
verbose = strcmp(theinput, 'true'); %if you only accept one case sensitive way of specifying the option
verbose = strcmpi(theinput, 'true'); %same but case insensitive
verbose = ismember(theinput, {'true', 'on', 'full'}); %if you want to allow several way of turning the option on.
verbose = ismember(lower(theinput), {'true', 'on', 'full'}); %same but case insensitive
  댓글 수: 2
Shojiro SHIBAYAMA
Shojiro SHIBAYAMA 2018년 7월 10일
Dear, Guillaume
Thank you for your answer. I was obsessed with the implementation way. I'll follow your suggestion. Thanks!
Steven Lord
Steven Lord 2018년 7월 10일
Guillaume is correct. See the "Using a MATLAB File You Plan to Deploy" section on this documentation page for an explanation.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by