フィルターのクリア

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 Center および File ExchangeArgument Definitions についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by