필터 지우기
필터 지우기

Can argument validation check if size is at least some value?

조회 수: 7 (최근 30일)
Tim
Tim 2023년 5월 9일
답변: Steven Lord 2023년 5월 9일
I understand that the arguments block can check if an argument is exactly a given size, but is there a way to check if an array is at least a certain size? (without using a custom validation function)
Example
arguments
a (:,4) % must be exactly 4 columns
b (:, >=4) % must have at least 4 columns
end

채택된 답변

Steven Lord
Steven Lord 2023년 5월 9일
No. You will need to create your own custom validation function. Use the mustBeEqualSize example on this documentation page as a model.

추가 답변 (1개)

Torsten
Torsten 2023년 5월 9일
편집: Torsten 2023년 5월 9일
b = 1:5;
v = size(b,2) >= 4
v = logical
1
b = 1:3;
v = size(b,2) >= 4
v = logical
0

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by