How do I configure enum in matlab?
4 ビュー (過去 30 日間)
古いコメントを表示
Hi guys,
I would like to ask about how do I define enum in matalb? I know there's enum classes in matalb & object oriented . but what Im asking is something more simple.
As in c/c++ I just was writing the type enum={Long,Short} -an array or list or whatever- and implicitly Long is configured to be equal to 1 (integer number), and short is equal to 2 (integer number).
what Im trying to do in matlab is :
I have function called ReverseBinary and gets one input as parameter called mode , i.e word the format of the function ReverseBinary(Mode) .
the parameter Mode is actually would have just two values Long, Short . and exactly as what I explained above I want to write an enum that Long is configured as 1, Short Configured as 2. So once I define that then I can call the function ReverseBinary(Long) or ReverseBinary(Short) , otherwise the parameters Long and Short aren't defined so I will get compilation error because Long/Short isn't defiend .
note- I call the function ReverseBinary from other funtion.
Any help please how I can do that in Matlab?
thanks alot.
0 件のコメント
回答 (1 件)
Jesús Zambrano
2020 年 12 月 21 日
Not sure about the exact issue you are having, but please have a look at the way to use Enumerations for, in this case, MATLAB Functino blocks in this link:
Hope it helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Filter Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!