save both matrices