h.ropen("infile")
h.ropen()
Example:
########################################### ### create a file titled "file.dat" with: # ### 42 13.7 # ### 14 64.1 # ### 12 9 # ########################################### from neuron import h, gui def r_open(ndat): h.ropen("file.dat") x = [] y = [] for i in range(ndat): x.append(h.fscan()) y.append(h.fscan()) h.ropen() return x, y # ndat is number of data points ndat = 3 x, y = r_open(ndat)
Warning
There is no way to open more than one read file at a time. The same is true for write files.
h.wopen("outfile")
h.wopen()
Example:
from neuron import h, gui def w_open(ndat, x, y): h.wopen("file.dat") for i in range(ndat): h.fprint("%g %g\n", x[i], y[i]) h.wopen() # ndat is number of data points ndat = 3 x = [42.0, 14.0, 12.0] y = [13.7, 64.1, 9.0] w_open(ndat, x, y)
h.xopen("hocfile")
h.xopen("hocfile", "RCSrevision")