Replacement for the function containers.Map()

조회 수: 6(최근 30일)
Ganesh Kini
Ganesh Kini 2020년 6월 10일
편집: Walter Roberson 2021년 5월 7일
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
Rik 2020년 6월 10일
Yes, if you know all possible keys and values you can hard-code them with a switch like you described.

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


Puru Kathuria
Puru Kathuria 2021년 5월 7일
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 2021년 5월 7일
As I mentioned in this comment, I don't think a hash function is actually required. Using ismember is probably faster.

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


Community Treasure Hunt

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

Start Hunting!

Translated by