MATLAB Answers

Replacement for the function containers.Map()

3 views (last 30 days)
Ganesh Kini
Ganesh Kini on 10 Jun 2020
Commented: Rik on 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 ?


Rik on 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 on 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 on 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.

Answers (0)


Community Treasure Hunt

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

Start Hunting!