Replacement for the function containers.Map()

11 次查看(过去 30 天)
Hi All,
Hope you are doing good.
I was doing some project, I found out a function called containers.Map() and it works fine according to the logic.
I wanted to know if there is a alternative to that function ? could you please help me out ?
  16 个评论
Ganesh Kini
Ganesh Kini 2020-6-10
编辑:Ganesh Kini 2020-6-10
I understand what you are saying. but for now since i need to get results rather the approach. So i guess case statements would work right? atleast for my problem that i am facing
Rik
Rik 2020-6-10
Yes, if you know all possible keys and values you can hard-code them with a switch like you described.

请先登录,再进行评论。

回答(1 个)

Puru Kathuria
Puru Kathuria 2021-5-7
Hi,
You can move forward by implementing your own map data structure with getters, setters and a hash function.
Otherwise, you might hardcode the data structure if all the key value pairs are known beforehand.
  1 个评论
Rik
Rik 2021-5-7
As I mentioned in this comment, I don't think a hash function is actually required. Using ismember is probably faster.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Data API for C++ 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by