Let a be a 2-dimentional list with each element being a set. For example, let a be a (3,3) list, I initialize as follows
a = [set()] * 3
a = [a] * 3
I now want to assign a[1][1] with another set. I do
a[1][1] = set([1,2,3])
But in doing this, not only a[1][1], but also a[0][1] and a[2][1] are assigned to this new set. It's so weird to me. How does this happen? How should I correct it?
Thanks!!
I set a to be a 2D list array because I want a to work like a = cell(3,3) as in Matlab.