(question)How does the arguments syntax apply multiple optional type restrictions to one of the input arguments?

2 ビュー (過去 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!

採用された回答

Anton Kogios
Anton Kogios 2023 年 2 月 22 日
function out = myFcn(inImage)
mustBeA(inImage,["uint8","logical","double"])
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by