a) Experimental set-up of the two-choice texture discrimination task with simultaneous two-photon imaging. Stim S = Smooth sandpaper, Stim R = Rough sandpaper. b) Trial structure and trial outcomes. c) Behavioral data from 44 consecutive trials of a single session with two textures. d) Left, Imaging field of view (depth = 140 μm) with located barrel centers (C1, D1, γ, δ) and selected neurons (orange numbers). Repeated for all mice (n = 13). Right, fluorescence (grey) and deconvolved fluorescence (black) traces from selected neurons. Traces are aligned to the trial start. Fluorescence traces have been corrected for neuropil contamination, baselined and z-scored. e) Normalized mean activity of all trial-coding neurons, i.e. neurons that distinguish between correct Stim/Lickport S and correct Stim/Lickport R trials. Neurons sorted by trial type preference and time of maximum activity. Single-plane recordings (30 Hz sampling rate) have been binned to match multi-plane recordings (5 Hz sampling rate).