(question)How does the arguments syntax apply multiple optional type restrictions to one of the input arguments?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Anton Kogios
2023-2-22
function out = myFcn(inImage)
mustBeA(inImage,["uint8","logical","double"])
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!