0
$\begingroup$

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?

$\endgroup$
0
$\begingroup$

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

    kini = 3.190597;
nstep = 0.02
n = 5
Table[NotebookEvaluate[
  "/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 }]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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