How do I extract a vector of results from a map?

4 Ansichten (letzte 30 Tage)
mutt
mutt am 22 Feb. 2013
Suppose:
X=[1 3 4 7 14];
Y=[0.4 6.2 5.1 0.9 3.8];
myMap=containers.Map(X,Y);
I can write myMap(4) and get the expected result 5.1. If Z=[4] I can write myMap(Z) and get the expected result 5.1. If Z=[4 14], myMap(Z) fails.
Why can't I provide a vector of valid keys and get a vector of values?

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 22 Feb. 2013
use the values() methods of the myMap object.
myMap.values({4,7})

Weitere Antworten (0)

Kategorien

Mehr zu Data Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by