Message Boards Message Boards


How to save output and use them latter on?

Posted 1 month ago
3 Replies
2 Total Likes

HI everyone, I have an issue concerning the saving of the results. Indeed, I need to save the results from a notebook in order to be able to use them later on in another notebook. I write the code for that. Basically I get a file which is suppose to contain my result (Fansa_test). But when I try to call the results back, the code takes a while despite the fact that I set the number of replications Rep=0. For example, for rep=9, the results should be enter image description here. But now when I run all the notebook till the last cell which contain the code to save the result. I get the file (Fansatest), the name I give to it. Now to call the result, (please uncomment << "Fansatest"; at this stage) in case you are testing the code which follows), set init="old" instead of init="new" (to call the stored solution) and set the number of replications Rep=0. The aim is to have the same results (just to load them). But the results don't show up. I get a long list of values. here is the code

Your support will be very appreciated. Thank you in advance.

3 Replies

Welcome to Wolfram Community!
Please make sure you know the rules:
Please next time, do NOT post massive code and ask to debug it. Minimize your questions to concise code examples pinpointing your issue.

Posted 1 month ago

Saving the result of a computation done in one notebook, and then reuse the result in a later Mathematica session? Using Iconize could be a way to do it.

In the source notebook do the computation and Iconize the result:

pairs = SolveValues[{x^2 + y^2 == z^2, x < 20, y < 20, Element[{x, y, z}, PositiveIntegers], x < y}, {x, y}]

Iconize[pairs // Normal, "Saved calculation result"]

Save the source notebook and restart Mathematica.

Open the source notebook. Copy the icon by marking it and Ctrl+C

enter image description here

Paste the icon in a new notebook and evaluate. The computational results from the source notebook will now be available in the new Mathematica session.

enter image description here

Posted 1 month ago

Thank you @Hans Milton I'll try to adapt and see if it work in my case. In my case I used the save command, it's working in simplest code, but when I try to use it in my more complex code, I don't get the right thing. I just do not know what is the problem.

Thank you for your time.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract