This is the basic multiplexed matrix shown earlier.
Figure 1 – Example 3 x 3 single multiplexed schematic.
It has the advantage of using the microcontroller pins more efficiently than the switch per pin option, but adds the cost of a diode per switch. The number of switches scales very quickly with your free I/O pins, with the maximum being achieved when the number of columns equals the number of rows. This setup is very easy to scan, as you merely activate one column at a time, and read in the rows. It can also trigger interrupts from any switch if you activate all the columns at once.