Saving each iteration on a .mat file as these two take too long to finish