Suppose I have a task that keeps things organized using contexts, so:
windowLength = 10; Begin["chocolate`"]; data = RandomReal[NormalDistribution, 100]; ListPlot[MovingAverage[data, windowLength]] End Begin["vanilla`"]; data = RandomReal[StudentTDistribution, 100]; ListPlot[MovingAverage[data, windowLength]] End
Now, if I want to go back and do something in the
chocolate context, I have to remember to re-run the line that enters that context or things can get very confusing and mistakes can easily be made.
It would be really neat to instead use wiggle-4 to create a Section called "Chocolate" and for everything in that section to run in the
chocolate context. Is there a way to set the context automatically based on the section of the notebook a cell is in?