Filter löschen
Filter löschen

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

7 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

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

Weitere Antworten (1)

Torsten
Torsten am 9 Mai 2023
Bearbeitet: Torsten am 9 Mai 2023
b = 1:5;
v = size(b,2) >= 4
v = logical
1
b = 1:3;
v = size(b,2) >= 4
v = logical
0

Kategorien

Mehr zu Argument Definitions finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by