This has a MATLAB script for evolving the incompressible 2D magnetohydrodynamic equations. We use the vorticity-current density formulation so that the spatial constraints are enforced exactly. Spatial differencing is done in Fourier space and time stepping with RK4.