Saving data from plots to a spreadsheet

Anything that doesn't fit elsewhere.
Post Reply
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

Saving data from plots to a spreadsheet

Post by lb5999 »

Hi All,

I have some graphs in a current plot window, displaying a potassium current in a somatic region from a simulation I have run from voltage clamping the soma, and I want to save this data into a spreadsheet (Microsoft Excel, for example). How do I do this?

Thanks,

L-dawg
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Saving data from plots to a spreadsheet

Post by ted »

See saving numerical results to a file http://www.neuron.yale.edu/phpBB/viewto ... &t=66#p113
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

Re: Saving data from plots to a spreadsheet

Post by lb5999 »

Awesome, thanks Ted!

Just a quick question...

I have multiple A-conductance responses on a single graph in NEURON. I have managed to export the data using the ascii method mentioned in print.pdf which is within the page you linked me to. I would like the end data file (say, in excel) to display the A-conductance value against time as a series of columns (each column corresponding to each A-conductance curve). At the moment I am getting a long list of 2 columns for each A-conductance curve in my graph.

Any suggestions on how I can produce such a dataset?

Thanks again,

L-dawg
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Saving data from plots to a spreadsheet

Post by ted »

lb5999 wrote:I have multiple A-conductance responses on a single graph in NEURON. I have managed to export the data using the ascii method mentioned in print.pdf which is within the page you linked me to. I would like the end data file (say, in excel) to display the A-conductance value against time as a series of columns (each column corresponding to each A-conductance curve). At the moment I am getting a long list of 2 columns for each A-conductance curve in my graph.

Any suggestions on how I can produce such a dataset?
If this is something you're just going to do one time, your most direct options are
--edit the file by hand
--write an awk or sed script that does it (these come with OS X and Linux; the MSWin installer puts cygwin's sed in c:\nrnxx\bin that you can use from the rxvt terminal that is launched by the rxvt item in the NEURON program group)

If you want to do this more than once, it's worth the effort to do some programming so that you can generate the desired output automatically. In pseudocode, this involves the following:

Code: Select all

// after model setup
set up Vector recording of t and the variable of interest
for each desired value of the independent variable {
  run a simulation
  append the Vector that holds the recorded variable to a List
}
Open a file.
Print the times and recordings of the variable of interest, 
in the desired format, to that file.
Close the file.
Post Reply