General usage of ParseInputs
조회 수: 16 (최근 30일)
이전 댓글 표시
Is there a guideline when I should use ParseInputs for input verification?
On one hand I think it is good to verify that the format of the inputs is according the specifications and on the other hand I am concerned about the performance when creating an object at every function call. Unfortunately, the documentations does not make any recommendations.
Do you have any suggestions?
댓글 수: 1
Adam
2018년 1월 5일
편집: Adam
2018년 1월 5일
I generally use
doc validateattributes
in every public function I write initially. I rarely use a varargin style of argument input so ParseInputs is a bit over the top for my usage, but I have used it sometimes.
When I am writing functions to be called in a massively iterative environment though I generally end up commenting these out. I like to keep them there as comments because they act as excellent documentation as well as (when not commented out) validation, but when called millions of times the overhead can be excessive. Usual overhead for one-call is usually irrelevant for validateattributes. I don't know about ParseInputs though.
채택된 답변
Benjamin Kraus
2018년 1월 5일
Are you referring to inputParser? As far as I can tell, there is no MATLAB ParseInputs.
If your concern is performance, my recommendation is to add inputParser to your code, then run the profiler and see whether it is having any significant performance impact. My guess is it won't significantly impact the performance, but the specifics will depend largely on your usage.
댓글 수: 3
BA
2018년 2월 10일
편집: BA
2018년 2월 10일
if your´re looking into the Code e.g. of webwrite, there is actually a function-ish "parseInputs()".
edit webwrite
% Parse inputs.
[postData, options] = parseInputs(mfilename, varargin);
When trying to open it via
edit ParseInputs
just a blank (new?) script opens.
My Problem is that coder recognizes this function as not supported but whithout knowing the occasion of this part it´s not easy to tell if it´s neccessary for my Code.
Walter Roberson
2018년 2월 10일
>> which -all parseInputs
/Applications/MATLAB_R2017b.app/toolbox/matlab/external/interfaces/webservices/restful/private/parseInputs.m % Private to restful
.. so not something you can call yourself.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!