Problem with fscan (SOLVED)

Anything that doesn't fit elsewhere.
Post Reply
AngeSurTerre
Posts: 2
Joined: Tue Mar 24, 2020 1:47 pm

Problem with fscan (SOLVED)

Post by AngeSurTerre »

Hello,
I'm new in the neuroscience field and the Neuron software, so my problem might be dumb. I have a file "Values.dat" that contains a list of numerical values. I was able to create this file by creating an object File() and then using the printf function. Now I want to be able to read from this file, which as I understand can be done by using the fscan function. Here is a test code that I wrote:

Code: Select all

objref MyFile
MyFile=new File()
MyFile.ropen("Values.dat")

for (i=0;i<10;i=i+1) {
    Value=MyFile.fscan()
    print Value
}

MyFile.close
From the documentation I read and from my Google searches, it seems that I'm using the fscan function properly. However when I run the code, I get the error message:
fscan not a public member of File
nrniv: File fscan
in Test.hoc near line 8
}
What am I doing wrong?
Last edited by AngeSurTerre on Wed Mar 25, 2020 3:13 pm, edited 1 time in total.
ramcdougal
Posts: 214
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Problem with fscan

Post by ramcdougal »

fscan is a function used for a single file opened with the ropen function (File.ropen is different).

If you are instead using the File class, then you'll want the scanvar method instead.
AngeSurTerre
Posts: 2
Joined: Tue Mar 24, 2020 1:47 pm

Re: Problem with fscan

Post by AngeSurTerre »

Perfect, that fully solves the problem!
Thank you!
Post Reply