I have the following code, which generate the mat file (in .npz format):
import numpy as np
x = np.arange(10)
np.savez('mat',x)
Now I want to append another array to the existing file:
y = np.arange(21)
np.savez('mat',y)
But, it replaces the x array with y. I want to have both of these arrays in the file. Besides, I do not want to write them to the file at the same time.