How to Determine a Matrix Layout