objref dtime, dsv, dcurrent
dsv = new Vector()
dtime = new Vector()
dcurrent = new Vector()

objref savcurrent
savcurrent = new File()


objref current_matrix
current_matrix = new Matrix()

proc saveIVplot(){
//FNAME=$1


dtime.record(&t)
dsv.record(&MSP_Cell[0].soma.v(0.5))
dcurrent.record(&IClamp[0].i)
init()
run()

savcurrent.wopen($s1)
savcurrent.printf(" Time somaV current\n")
current_matrix.resize(dtime.size(),3)
current_matrix.setcol(0, dtime)
current_matrix.setcol(1, dsv) 
current_matrix.setcol(2, dcurrent) 

current_matrix.fprint(savcurrent, " %g")
 
savcurrent.close() 
}