Re: Saving again ...
- To: mathgroup at smc.vnet.net
- Subject: [mg21874] Re: [mg21816] Saving again ...
- From: Jacqueline Zizi <jazi at club-internet.fr>
- Date: Wed, 2 Feb 2000 22:54:31 -0500 (EST)
- References: <200001300846.DAA08646@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Robert wrote: > first of all, thanks to the replies concerning the questions about > constructing the name of a file (imho an example of how simple > "problems" are solved in a complicated way by mathematica). Sorry, I was busy else where and I did not follow the discussion . What does mean your "imho"? I can't find this word in my dictionary and then, Robert wrote: > unfortunately i've another question: to save resuls, you can use the > save-command. how can i save all variables at once, without naming each > one separately? ??? If you have "variables", it is because you named them, don't you? You can program and get nice results without naming things and without using a lot of "variables" . As Mathematica is a symbolic system and save all related symbols to one, it suffices to save the right symbol to save quite a lot. That is just a question of how you structure your code. Nevertheless, if you like having a lot of independant "variables" in a messy way when exploring and if you want to get a list of it, for example in a separate file, you can do the following: Put at the beginning of your main file this 2 lines : $flux$ = OpenAppend["allVariables"]; $NewSymbol = WriteString[$flux$, #1, "\n"] &; Then make all setting you want. For example : a = 3 ; b := 5 a; relatedTo [f] ^= 6 x; color [f] ^:= 6 x + y ; y := 3 a + 2c; x = 10 a; rule1 = a -> b; rule2 = x :> y; Then put the following line at the end of all your computations in your main file Close[$flux$]; This done, you have created a file named "allVariables" with a column of all your symbols. Is it what you want? You can use this list as you pleased, where you please. You can sort it or whatever. For example : Information /@ Import["allVariables", "List"] will give you definitions, plain values, upvalues, rules and Co with all values in place following the order you evaluate your assignments. If you wrote this line is in a fresh new file, you can print or keep the lot to show it after all, if this is what you want. All depends on what you want to do with your savings. For example, suppose you want to save all information related to f included assignments of related variables, just do: Save ["anExample", f] to get: color[f] ^:= 6*x + y relatedTo[f] ^= 6*x x = 30 y := 3*a + 2*c a = 3 in the file "anExample". Then Quit and even shut down the machine if you want to. Another day load the file "anExample" will suffice to have all information about f without loading your main file. For example: color [f] 189 + 2 c I hope this help answering what I found interesting to answer as it is what I should call: "une question en l'air"