(question)How does the arguments syntax apply multiple optional type restrictions to one of the input arguments?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
cui,xingxing
le 22 Fév 2023
Réponse apportée : Anton Kogios
le 22 Fév 2023
For example, I need to restrict the type of the input argument inImage to "uint8" or "logical" or "double" for the following signature function How do I do this ?
function out = myFcn(inImage)
arguments
inImage uint8 % uint8|| logical|| double
end
end
It seems that the type restriction can only be one, I tried to write uint8|| logical|| double like this, but it is not syntactically correct!
0 commentaires
Réponse acceptée
Anton Kogios
le 22 Fév 2023
function out = myFcn(inImage)
mustBeA(inImage,["uint8","logical","double"])
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!