필터 지우기
필터 지우기

How to check success of inputParser.parse method

조회 수: 1 (최근 30일)
David Ternet
David Ternet 2013년 8월 2일
답변: AKARSH KUMAR 2020년 6월 24일
I like the inputParser class and the ability to register checks for the input parameters, but how does one easily detect if a required input passed the checks? For example, I have a function that has a column index as an input parameter. If the column index is out of range, the function should do nothing and return 'false' for the success output value. So I set up an inputParser with the an anonymous function with the input checks for addRequired, then I call parse, but how do I know if the input passed the checks. It seems that after the parse method, I then need to check if my input colIdx == p.Results.colIdx. Is there a better way? It would be a lot simpler if parse could just return true/false if all required inputs passed the checks.

답변 (1개)

AKARSH KUMAR
AKARSH KUMAR 2020년 6월 24일
As far as my knowledge is concerned there is no inbuilt parser check, you can check by putting breakpoints in your code and checking the value in the workspace.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by