save snapshots in mat files