I have a large notebook with multiple sections. I would like to run the entire notebook with one variable change kquads. At the end of the notebook, I added one loop

Do[(Clear @@ DeleteCases[Names@"`*", "kquad" | "i"]; 
  kquad = 3.190597 + 3.190597 0.01 i; Print[kquad]; 
  NotebookEvaluate@EvaluationNotebook[]), {i, -2, 2, 1}]

However, this loop looks i always equals to -2. Probably, the selfevaluation also initial this command as well, set i =-2... How could I make i equals to -2,-1,0,1,2?


1 Answer 1


I solved this problem. Make a separate notebook and do this loop. It works.

    kini = 3.190597;
nstep = 0.02
n = 5
  "/Users/wange/Documents/Research/strong hadron cooling/lattice \
design/MBI/MBreduce/MB reduce.nb"], {kquad, kini - n nstep kini , 
  kini + n nstep kini, nstep kini }]

Your Answer

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

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