May-16-2023, 08:36 PM
Thanks Gribouillis,
Your advice helped me a lot; based on your example, I modified it a bit in order to concatenate different data with different sizes.
Paul
Your advice helped me a lot; based on your example, I modified it a bit in order to concatenate different data with different sizes.
import numpy as np import os path = str(os.getcwd()) # Creating a numpy array n = 10 # 1_000_000# 10_000_000 M1 = np.random.random((n, 3)) m = 100 M2 = np.random.random((m, 10)) # Opening a file with open(path + '/file.txt','w+') as f : #appending M1 np.savetxt(f, M1, fmt='X=%.18e, Y=%.18e, Z=%.18e', header = 'blabla') # add of an intermediate line f.write("####### a comment is added\n") np.savetxt(f, M2)Thanks
Paul