The concepts behind a container map and a struct are quite different:
A container map is used to create a mapping or indexing. For example if you have a matrix A
and want to index the element in the second row and second column, you will index it using A(2,2)
. For numbers, matrices and so on, where you want to index a specific row number, this is convenient. Assume however, you have a situation as shown in the following example by Mathworks:

Here you have an array of values, which you could index as value(1)
for January, and so on. However this is not very legible. It would be much more convenient if you could index it with value('Jan')
. This is exactly what container maps offer. As @marsei remarked in his comment, container maps are a Java-based, unordered, construct, that uses hash-tables for indexing.
A struct is a different construct, which is C-based and ordered (thanks for the insignt @marsei). The main use of struct is to help you store data in a more logical way. For example when using images, you often have two variables: one for the image data, and one for the color map. Without structs, you need to keep those two separate variables in the workspace. For multiple images this gets very confusing (e.g. using names like img0_data
, img0_map
and so on). A struct helps you organize this in a simple way: A struct called img0
with the fields data
and map
.
In the context of dictionaries, both constructs are more or less equivalent, though structs usually seem to be faster than container maps. Plus, as already mentioned in the question, the key
of a container map can be any single value, while for structs it has to be a string.