See https://www.neuron.yale.edu/phpBB2/viewtopic.php?p=3322
A similar trick can be used to record and plot the max or min of any other range variable,
e.g. ionic conductance, current, concentration etc..
How to plot peak depolarization throughout a cell
Moderators: ted, wwlytton, tom_morse