Accessing and assigning matrix elements