2

Possible Duplicate:
How can I index a MATLAB array returned by a function without first assigning it to a local variable?

I have a question with regards to accessing array elements stored as values of a containers.Map object. I have successfully created my containers.Map object where the keys are strings, and the values are zeros(1,3) arrays.

myHashTable = containers.Map(keys,values);
myHashTable(keyString)

would give me:

ans =

0 0 0

What I am having trouble with is accessing values stored within these arrays at a specific index. For example trying to do this:

myHashTable(keyString)(1)

would give me the error:

()-indexing must appear last in an index expression.

How would I go about accessing the elements of an array stored as a value in the container without using another variable like:

tempArray = myHashTable(keyString);
tempArray(1)

Edit: Found an answer to the question. It has been asked before but I didn't find it in my preliminary search. Can't close my question because I I don't have the required reputation points to do so immediately. For those interested check:

How can I index a MATLAB array returned by a function without first assigning it to a local variable?

Community
  • 1
  • 1

0 Answers0