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에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!