I found the question How can I index a MATLAB array returned by a function without first assigning it to a local variable? in an attempt to figure out why I was getting errors with indexing a value returned by the containers.Map function until I used a local variable, but I still don't really understand what's actually going on. From the answers to that question, I can see that the most readable way to index data structures returned by functions is to just use a temporary variable. But my question is why it's invalid to do something like this:
letters = {'a', 'b', 'c', 'd'};
voltages = {{1.8, 1}, {0.7, 1.5}, {1.8, 0.1}, {1.8*, 1.8}};
VGS_VDS_dict = containers.Map(letters, voltages);
temp = (VGS_VDS_dict('a')){1}
But perfectly fine to do
temp1 = (VGS_VDS_dict('a'));
temp2 = temp1{1}
?
What is it about the grammar of MatLab that makes the first example invalid but not the second one?