MATLAB Answers

Replacement for the function containers.Map()

조회 수: 7(최근 30일)
Ganesh Kini
Ganesh Kini 10 Jun 2020
댓글: Rik 10 Jun 2020
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

표시 이전 댓글 수: 13
Rik 10 Jun 2020
Why do you insist on using tools that are not suited for this job?
If you want to implement containers.Map you should not be using switch-case statements. If you don't want to implement it, then you can use that instead.
Either implement the class in the way I suggested, or don't implement the class at all. Apart from minor tweaks, I don't see any other way.
Ganesh Kini
Ganesh Kini 10 Jun 2020
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 10 Jun 2020
Yes, if you know all possible keys and values you can hard-code them with a switch like you described.

Sign in to comment.



Translated by