I'm new to Mathematica, and I'm using it as a tool to my studies, specially in graph theory. Now I have to simulate a random graph a number of times to make the statistical analysis of these simulation runs, but I got into one problem, which is the fact that whenever I open and evaluate the notebook, Mathematica evaluates the cell with the simulation runs, thus changing the graphs being analyzed. How can I make the cell be evaluated just once and store the graphs for future uses?


1 Answer 1


Highlight the bar on the right next to the cell you want to not evaluate. Then on the notebook's menu, go to Cell - Cell Properties - Evaluatable and deselect it. Here's a shot of a Plot[ ] function where I highlighted the right vertical bar. You can see the Cell menu item above it.

enter image description here

  • $\begingroup$ Thanks a lot, this solved all my problems with this notebook. $\endgroup$
    – nicholas80
    Commented Apr 25, 2017 at 21:57
  • $\begingroup$ there seems to have a problem in using this solution, the results aren't stored after the notebook is closed. Totay Ive oppened the file to continue the analysis, and the variables where I've stored the graphs' simulation runs were empty. For exemple:igplgsim = Table[IGStaticPowerLawGame[1032, 1441, 2.899)], 1000]; and basimm2 = Table[RandomGraph[BarabasiAlbertGraphDistribution[1032, 1]], 1000];. the list with the results of the simulation runs were stored in these variables and I've saved after that, yesterday they had a list of graphs for me to analyze, today they are empty. $\endgroup$
    – nicholas80
    Commented Apr 26, 2017 at 12:52
  • 1
    $\begingroup$ So one thing you can do is save the result to a file and load it back in. But what I'll typically do is run the computationally intensive code without a ';' on the line and get an output. Then click my cursor into the beginning of the output line, which turns it to bold font and allows you to take that output and convert it to a new input line, and assign it to a variable. You can hide the new input cell if it is monstrous. Finally, make the original calculation not Evaluatable. $\endgroup$
    – MikeY
    Commented Apr 26, 2017 at 13:59
  • $\begingroup$ Thanks @MikeY, again it is a very helpful advise, I'll do the same way you do for the time being, since I don't know how to load pieces of code our inputs/outputs stored on another Mathematica file, I only know how to import the whole file. $\endgroup$
    – nicholas80
    Commented Apr 26, 2017 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.