a, A task-switching protocol for inducing spine activity and Ca2+ spike asynchronously. b, Changes in the peak amplitude of Ca2+ transients in FWR-activated spines versus the time interval between spine activity and a BWR-induced Ca2+ spike. c, Changes in the peak amplitude of spine Ca2+ transients under various conditions. Spines active within 5 s before the spike generation show a significant reduction in the peak amplitude of Ca2+ transients when measured again during FWR training (n = 18 spines), whereas spines active >5 s before the spike (n = 31 spines) or active spines without encountering spikes (n = 31 spines) showed no reduction. Local application of MK801 blocked the reduction. d, No correlation between the percentage change in the peak amplitude of spine Ca2+ transients and Ca2+ spike amplitude (Pearson correlation). Data are mean ± s.e.m. ***P < 0.001, paired t-test and Wilcoxon matched-pairs signed rank test. See Methods for statistical details.