How to individually control electromagnets in a 16x16 matrix?
You have two options. Power multiplexing - where you have an array of magnets and you pulse the power into them, or Control multiplexing - where you have an array of magnet driver devices, and you distribute the logic level control to them.
Power Multiplexing
It is theoretically possible to do power multiplexing with electromagnets. If you supply one electromagnet with 16x the rated voltage for 1/16th of the total time, and provide a free-wheel path round it with a diode, it will operate at more or less the same current as giving it the rated voltage for the whole time.
A 16x16 array can therefore be multiplexed driving a whole row at a time, each column for 1/16th of the time, with the PSU supplying 16x the voltage and 16x the current as for a single magnet.
That makes a number of assumptions about the magnets (a) the insulation will take the extra voltage (b) you are multiplexing fast enough to get a current smooth enough for your application.
The magnets will not turn on and off as fast as a LED, if fact your 'warm-up time' is closer to the mark. While the voltage is on, the current in the coil will increase rapidly. While the other columns are being driven, current continues to flow through the free-wheel diode, decaying slowly due to the voltage drop in diode and the coil resistance. The time taken to bring the current up, and to decay away, depends on the supply voltage, the inductance, and the resistance of the coils.
A big argument against multiplexing 16x the voltage to an array is what happens if when the software crashes and a column of magnets receives a continuous 16x voltage supply. Fuses or current limiting is needed, and/or a multiplex failure shutdown of the supply.
As you say in your OP that you are at best dangerous, building a 4A 192v system with some built-in failure modes is probably not the best way to go.
Control Multiplexing
The alternative control multiplexing would be far safer. The standard way that people expand their arduino or pi outputs is to use a string of HC595s, in your case 32, as they have 8 outputs each. They require 3 pins from the MCU to drive them, clock, data and a strobe. You can get standard software libraries for pi and 'duino that will handle this array for you.
One option for magnet driving is to use the ULN2803, an 8 channel darlington driver, capable of 30v and 500mA per channel, with built-in kickback diodes. However, package dissipation would limit each one to driving only four channels at the same time, so it's not necessarily a good choice.
If you use FETs for driving, and want to connect them directly to the 595 outputs, then make sure that they are 'logic level' input types. This means not only Vgsth &lt;&lt; 5v, but also an RDSon specified at Vgs of 5v or less.
A large series gate resistor should slow down the turn-off transient through the Miller effect sufficiently to avoid the need for a kickback diode (as long as you do the calculations and measurement) though such diodes are only pennies, so would be sensible to include anyway.
While buying 256 single FETs seems like a lot, you'd get quantity pricing, and you already have 256 magnets, so are handling the scale somehow. You might want to design an interface board that handles (say) 2x HC595 and 16x FETs, gate resistors and kickback diodes, as a module, to simplify your integration and wiring. I usually use DirtyPCB for things like this, but plenty of other cheap, online, PCB suppliers are available. Having multiple small boards eases things like power distribution (a 4A wire to each board), and repairs (build a few extra boards, and swap one if needed), and bringup (just build one board, get it working, add another, rinse and repeat).