My goal is to initialize a Map object with a double key and structure for the value.
I have a structural array similar to this:
s(1) = [1,2,3];
s(1) = 'str';
s(2) = [4,5,6];
s(2) = 'str2';
s(3) = [7,8,9];
s(3) = 'str3';
Then I want to create a map object, for example:
awesome = container.Map(1:3, s);
but I get the following error:
Error using containers.Map
Specified value type does not match the type expected for
this container.
But it works if I do:
awesome = container.Map(1:3, {s1, s2, s3});
Why is this happening and how can I make it work while preserving the structure as a value type?
source
share