User`s guide

R2010a
13-18
Programming
Subscripting Into Function Return Values
If you have a function, such as the following, that returns a struct array:
function structOut = getStruct
structOut = struct('fieldA', 5, 'fieldB', 10);
it is no longer valid to access fields of the structure by directly dot indexing the function's
return value, as shown here:
getStruct.fieldA
Instead, you should first assign the returned structure to a variable, and then dot index
the variable:
s = getStruct;
s.fieldA
ans =
5
This type of field access has never been allowed within function code, and this change
causes scripts and command line statements to be in agreement with function rules.
Compatibility Considerations
If you have scripts that employ this type of dot indexing, they will now throw an error.
Replace this unsupported style of dot indexing with the style shown above.
New Constructor for Map Containers
The following command constructs an empty containers.Map object that uses a key
type of kType, and a value type of vType:
M = containers.Map('KeyType', kType, 'ValueType', vType)
See the containers.Map function reference page for more information.
Function Handle Access to Private and Protected Methods
When creating a function handle inside a method of a class, the function is resolved
using the permissions of that method. When MATLAB invokes the function handle,