Nengo simulation caused index out of range on MultiDim matrix, so added range checking to stateVaraible