defaultValue - set default value for optional arguments

Assigns default value to funtion optional input variable

이 제출물을 팔로우합니다

DEFAULTVALUE Assigns default value to funtion input variable
DEFAULTVALUE ('NAME',VAL) check if variable NAME doesn't exist or
is empty. If this is the case, it assigns it the value VAL.
DEFAULTVALUE ('NAME',VAL,EMPTYVAL) assigns value VAL to variable
NAME if it doesn't exists or value EMPTYVAL if it's empty.
NOTE: The variable value IS NOT the function output. The function must
be called without output

Example:
function c=sumab(a,b)
% This function can be called either with one or two input arguments
narginchk(1,2)
defaultValue('b',1)
c=a+b;

By Luca Amerio
luca.amerio@polimi.it
27/01/2016

인용 양식

Luca Amerio (2026). defaultValue - set default value for optional arguments (https://kr.mathworks.com/matlabcentral/fileexchange/55120-defaultvalue-set-default-value-for-optional-arguments), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Profile and Improve Performance에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0