Not sure if this is the exact solution, but in the loops within assignvalues(), you are always assigning a value to one.cellarray[0] (you reset x to zero with every look). So if you ever try to...