Some enumeration members are unrecognized

조회 수: 3 (최근 30일)
Bogdan -Ervin
Bogdan -Ervin 2025년 7월 26일
댓글: Bogdan -Ervin 2025년 7월 26일
It may be an elementary question, but I have an enumeration class (in a class folder) which its last 2 members are not recognized. I have the impression that those elements were recognized in Matlab R2020a.
The members I am talking about are Unknown and Nothing. They can not be referenced with Element.Unknown and Element.Nothing, but the rest of the members can be.
Why is it happening and how to solve the issue?
Thank you in advance for response!
EDIT: On my end, when I call Element.Unknown and Element.Nothing I am given the errors "The class Element has no Constant property or Static method named 'Unknown'.", respectively "The class Element has no Constant property or Static method named 'Nothing'."

채택된 답변

Matt J
Matt J 2025년 7월 26일
편집: Matt J 2025년 7월 26일
I'm not encountering any problems in 2024b. Perhaps you forget that you implemented a disp method, which displays those members in a unique way.
>> Element.Doom
ans =
Doom
>> Element.Unknown
ans =
???
>> Element.Nothing
ans =
  댓글 수: 3
Matt J
Matt J 2025년 7월 26일
That sounds more as though you have a 2nd definition of the Element class floating around somewhere on your path. You should check,
which -all Element
Bogdan -Ervin
Bogdan -Ervin 2025년 7월 26일
Thanks! That was it. In the same directory I had an enumeration class Element in Element.m and a class folder where the class I shared resides.
It seems I misinterpreted the call precedence (I thought that the constructor of the class in class folder takes precedence over the other class).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by