Object as a key in a map container

조회 수: 7 (최근 30일)
ionas
ionas 2017년 6월 2일
답변: Feilin Jia 2018년 2월 12일
I have two different class types. Can I use in the map container one as a value and the other as a key?

채택된 답변

Adam
Adam 2017년 6월 2일
No. Keys are restricted to:
'Possible values are 'char', 'double', 'single', 'int32', 'uint32', 'int64', or 'uint64'.'
So I guess if your class inherits from one of these then you can (I don't think I have tried this), but not otherwise.

추가 답변 (1개)

Feilin Jia
Feilin Jia 2018년 2월 12일
No. I have the same question with you. I tried, but it gives me error. The key must be a number or character.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by