How to loop through files in a folder?
Posted: Thu Mar 16, 2017 5:31 am
Hello all,
Is there a way I can loop through files of a folder in hoc language?
Basically, I am using a model from the NEURON database (https://senselab.med.yale.edu/modeldb/S ... del=151460) as a starting point for my project. What I need to do is running successive simulations with different input files for the waveform (no need to focus on what's the input file is, I don't think that's relevant). Everything's OK manually, but I have around 50 simulations (50 different input files) to run, so that's not a possibility in practice. Is there a way I can loop through the files in the folder so NEURON takes each as input for one simulation?
I also thought about having one big file which would contain all the files I need one after the other (everything appended basically), and somehow make NEURON read the values from line 0 to 500 (for eg.) for the first simulation, then line 501 to 1001 for the second, etc. However, first solution, if possible, would be much more elegant and practical...
Can someone help?
Thanks!
Is there a way I can loop through files of a folder in hoc language?
Basically, I am using a model from the NEURON database (https://senselab.med.yale.edu/modeldb/S ... del=151460) as a starting point for my project. What I need to do is running successive simulations with different input files for the waveform (no need to focus on what's the input file is, I don't think that's relevant). Everything's OK manually, but I have around 50 simulations (50 different input files) to run, so that's not a possibility in practice. Is there a way I can loop through the files in the folder so NEURON takes each as input for one simulation?
I also thought about having one big file which would contain all the files I need one after the other (everything appended basically), and somehow make NEURON read the values from line 0 to 500 (for eg.) for the first simulation, then line 501 to 1001 for the second, etc. However, first solution, if possible, would be much more elegant and practical...
Can someone help?
Thanks!