MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re : Re: Interpolation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75158] Re: Re : Re: Interpolation
  • From: Albert <awnl at arcor.net>
  • Date: Thu, 19 Apr 2007 04:26:24 -0400 (EDT)
  • References: <evsq9b$p3$1@smc.vnet.net> <200704160808.EAA09493@smc.vnet.net> <f04ohp$9f5$1@smc.vnet.net>

Hi,

> I did what you said and of course it works. Then I realised that
> I have another problem! I do Save["tmpfile1",abcd] in the first
> notebook then Save["tmpfile2",abcd] and so on. The problem is that
> all variables have the same name in each notebook. I have abc and d
> with the same definition. I built one notebook on the first
> set of data then I renamed the notebook and just change the name
> of the dataset I'm doing the same calculations on all data sets.
> 
> Now is it possible to change the name of variables when I do a save.
> Or do I have to go back in each notebook and change the variable names.

I think the easiest way to achieve what you need is to create the 
symbols you save in a specific context, that is put a 
Begin["notebook1`"] at the beginning of notebook 1 and corresponding 
lines to the other notebooks. The Save then should save the variables as 
notebook1`abcd and notebook2`abcd respectively. When loading the saved 
files, you of course need to refer to the variables with the full long 
name, that is notebook1`abcd and notebook2`abcd.

Another possibility to achieve what you want is to switch namespaces 
when you _load_ the files. Then you do not even need to recreate the 
saved files that you allready have. This would be something along the lines:

Begin["n1`"]
Get["tmpfile1"]
End[]
Begin["n2`"]
Get["tmpfile2"]
End[]
(*example: compare two results: *)
n1`abcd == n2`abcd

I have not tested any of the suggestions but am very positive that you 
can get things running this way, still you might need to experiment a 
little to get it work.

hth,

albert


  • Prev by Date: Re: Interpreting the solutions
  • Next by Date: Re: neat way to program minimum of sum
  • Previous by thread: Re : Re: Interpolation
  • Next by thread: Differentiation and evaluation of function