Re: Clearing selected variables
- To: mathgroup at smc.vnet.net
- Subject: [mg86648] Re: Clearing selected variables
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sun, 16 Mar 2008 04:38:41 -0500 (EST)
- References: <frg0ef$f0b$1@smc.vnet.net>
pradeep wrote: > Hello All, > is there a way i can selectively clear all but a few variables in > mathematica?? i have a large number of variables and am iteratively > running my entire notebook through a loop and want most variables except > a few to get cleared between iterations.. > any help would be appreciated! > > thanks! > Pradeep > Purdue University > By far the best technique is to wrap your calculations in Module or Block and use local variables. Each time the Module or Block construct terminates the local variables are lost - so your big loop should go outside these constructs. Those variables that you want to keep, should not be local, so as Global variables they will carry over from one iteration to the next. David Bailey http://www.dbaileyconsultancy.co.uk