How to find out if a class is a handle class?

조회 수: 17 (최근 30일)
broken_arrow
broken_arrow 2023년 3월 12일
편집: Matt J 2023년 3월 15일
How can I find out if a class is a handle or a value class? Unfortunately I can't seem to figure it out. Take e. g. matlab.mixin.CustomDisplay. The documentation only says it's handle compatible, but not if it is itself a handle class. I need a class that inherits from handle and matlab.mixin.CustomDisplay. So if the latter is itself a handle class, inheriting from handle would be redundant, right?

채택된 답변

Matt J
Matt J 2023년 3월 12일
편집: Matt J 2023년 3월 15일
How can I find out if a class is a handle or a value class?
You can use,
isa(obj,'handle')
I need a class that inherits from handle and matlab.mixin.CustomDisplay. So if the latter is itself a handle class, inheriting from handle would be redundant, right?
It would be redundant to inherit both from handle and one of its subclasses. However matlab.mixin.CustomDisplay is not a subclass of handle, so it is not redundant in that case.
  댓글 수: 1
broken_arrow
broken_arrow 2023년 3월 15일
Ah, ok. So that's the way it's done. Thanks a lot.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by