Variable names as variables

Using the graphical user interface to build and exercise models. Includes customizing the GUI by writing a little bit of hoc.

Variable names as variables

Postby mctavish » Mon Aug 14, 2006 11:50 am

I am trying to implement a general cross-correlation GUI where the user types in the variable names to be cross-correlated. I have two problems.

1) How can I make a field where the user can type the name of the variable? Alternatively, how can I interface with the variable window that comes up in the "Plot What?" of a graph to obtain variables/ variable names?

2) Given a user-defined variable as just described, how can I then use it in cvode.record()? The problem is that I can hard-code a variable name in hoc code, but I do not see a way to have the first parameter dynamically assigned.

Thanks,
Tom
mctavish
 
Posts: 74
Joined: Tue Mar 14, 2006 7:10 pm
Location: New Haven, CT

Postby ted » Mon Aug 14, 2006 2:43 pm

1) How can I make a field where the user can type the name of the variable? Alternatively, how can I interface with the variable window that comes up in the "Plot What?" of a graph to obtain variables/ variable names?

You want to use a SymChooser.
http://www.neuron.yale.edu/neuron/static/ ... SymChooser
2) Given a user-defined variable as just described, how can I then use it in cvode.record()? The problem is that I can hard-code a variable name in hoc code, but I do not see a way to have the first parameter dynamically assigned.

So don't hard code it. Use sprint
http://www.neuron.yale.edu/neuron/static/ ... tml#sprint
to assemble the command string you want, then use execute
http://www.neuron.yale.edu/neuron/static/ ... ml#execute
to execute that string.

Here's a general strategy for how to find answers in the Programmer's Reference:
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=554
ted
Site Admin
 
Posts: 3587
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Postby mctavish » Wed Aug 16, 2006 3:55 pm

Great answer, Ted. Thanks!
mctavish
 
Posts: 74
Joined: Tue Mar 14, 2006 7:10 pm
Location: New Haven, CT


Return to The GUI

Who is online

Users browsing this forum: No registered users and 1 guest

cron