I just pickaxe the whole Crystalarium up and out pops the mineral you put in, plus the machine itself. Place the Crystalarium back down and put the new mineral in.
I'm sure there's another way to do this but not one that makes that satisfying <thump> sound when you pickaxe a machine up!
If you want to replace the crystals within a large number of Crystalaria, use an upgraded Hoe and hold down to charge it before swinging,, it'll thunk many at once and save you time.