MATLAB: expanding the list of values ​​in the container.

I read the documentation for using the Matlab container. Create something similar to a Python dictionary, but I ran into some problems and hoped that someone could shed some light.

Is there a way to expand the contents of a list of values ​​that maps to a specific key? for example, for a card "card", the key is "1234" I have a value of "1.0".

map(1234) = 1.0

I would like to expand the list of values ​​to [1.0 2.0], and the way I'm trying to do this is

map = containers.Map(1234,1.0)
map(1234) = [map(1234) 2.0]

but I get the error "Error using container.Map/subsasgn. The specified value type does not match the type expected for this container."

Can't I associate arrays as values ​​with a map key?

Many thanks!

+5
1

, ValueType "any". , , , .

, , , . , , "double". .

>> map = containers.Map(1234, 1.0);
>> disp(map.ValueType)
double

default.Map KeyType 'char' ValueType 'any'. , , char. "double" "any", , .

map = containers.Map('KeyType','double', 'ValueType','any');
map(1234) = 1.0;
map(1234) = [map(1234) 2.0];
+7

All Articles