I am computing a table of orbital parameters where I can change some orbital properties. The first time I run the script after a global clear (ClearAll["Global`*"]), the script fails with an error message but if I run it again, it works correctly. I am unable to understand what is happening. An example calculation that I think mirrors the control flow of the calculation is
 
Column[{Labeled[Manipulate[Module[{},
     y = ConstantArray[14, {10, 4}];
     x = y[[1 ;; n]];
     headings = 
      Map[Style[#, Bold] &, {"col 1", "col 2", "col 3", "col 4"}];
     PrependTo[x, headings];
     Grid[x, Alignment -> Center, Frame -> All, 
      Background -> {None, {LightGray, None}}]], {{n, 1, 
      Style["Nums", 12, Bold]}, Range[10], ControlType -> PopupMenu}],
    Style["Circular Orbits", 16, Bold], Top], 
  Labeled[Manipulate[Module[{},
     y = ConstantArray[k, {10, 4}];
     x = y[[1 ;; m]];
     headings = 
      Map[Style[#, Bold] &, {"col 1", "col 2", "col 3", "col 4"}];
     PrependTo[x, headings];
     Grid[x, Alignment -> Center, Frame -> All, 
      Background -> {None, {LightGray, None}}]], {{m, 1, 
      Style["Nums", 12, Bold]}, Range[10], 
     ControlType -> PopupMenu}, {{k, 1, Style["Const", 12, Bold]}, 
     Range[10], ControlType -> PopupMenu}], 
   Style["Circular Orbits", 16, Bold], Top]}]
This script runs correctly after the global clear. The file that fails is attached. Perhaps someone more skilled at Mathematica can understand what is going on.
Thanks, Mike
				
					
				
				
					
					
						
							 Attachments:
							Attachments: