APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Resetting certain variables with reset button but not all the variables post and replies

Return to the Resetting certain variables with reset button but not all the variables thread
Login to post to this thread

Resetting certain variables with reset button but not all the variables
fergal wallace
3 Posts

I'm trying to reset some of my variables with the rest button but not all the variables. Basically what i want to do is choose which variables are reset when the reset button is clicked.
_reset()    is just resetting everything. I want to reset just three variables.
Seems like such an easy thing to do in my head but i've just had trouble with it.
Any help much appreciated!!


Replies to Resetting certain variables with reset button but not all the variables

Re: Resetting certain variables with reset button but not all the variables -
Francisco Esquembre
237 Posts

_reset() does the following:
- sets all variables to the values indicated in the tables of variables
- runs the Initialization code (+ Fixed relations)

however, initialise() only runs the Initialization code (+ Fixed relations)

By setting the value of some variables (and not others) in the Initialization pages, you can call initialise(9 to get what you want.

Cheers,

Paco



Re: Re: Resetting certain variables with reset button but not all the variables -
fergal wallace
3 Posts

worked great paco :-)
Many thanks!!



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book