Save vectors to file in Python with NumPy -


i have variable numeric value, variable string value, , 2 vectors defined numpy

a = 10 b = "text string" positions = np.array([]) forces = np.array([]) 

i want save these values file. i've used http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html save 2 vectors with

np.savetxt('test.out', (positions,forces)) 

but need store values of a , b.

how possible?

personally recommend using numpy.savez , numpy.load. example:

numpy.savez('test.npz', a=a, b=b, positions=positions, forces=forces) 

you can load again this:

data = numpy.load('test.npz') = data['a'] 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -