Object as a key in a map container
4 次查看(过去 30 天)
显示 更早的评论
I have two different class types. Can I use in the map container one as a value and the other as a key?
0 个评论
采纳的回答
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.
0 个评论
更多回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!