defaults.m

버전 1.0.0.0 (1.92 KB) 작성자: jl
Utility function to simplify setting default values for variables in functions.
다운로드 수: 308
업데이트 날짜: 2014/7/30

라이선스 보기

Syntax:
DEFAULTS('Variable',Value)

Problem:
Usually in a function call:
out = function(Var1, Var2)

if (~exist('Var1','var')
Var1 = 1234;
end
if (~exist('Var2','var')
Var2 = 3456;
end

This gets tedious after a while.

Solution using DEFAULTS
out = function(Var1, Var2)
defaults('Var1',1234,'Var2',3456);

인용 양식

jl (2025). defaults.m (https://kr.mathworks.com/matlabcentral/fileexchange/47394-defaults-m), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2011a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Argument Definitions에 대해 자세히 알아보기
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0