## Code repository for *Hasegawa & Huang et al.* This code can be used to generate main and supplementary figures of Hasegawa, Huang, Paricio-Montesinos & GrĂ¼ndemann (original preprint https://doi.org/10.1101/2023.08.23.554119). Data can be downloaded from the data repository https://gin.g-node.org/GrundemannLab/2024_Hasegawa_Huang_et_al_DATA. Code can be executed in MATLAB2020a (MathWorks). **Fig1-2 and Fig S1, 3, 4, 6** Load data by `load('...\Fig*\*.mat')`. **Fig3-4, SVM_decoding** Laod data by `load('...\Data\Fig3_FigS7-18\*\*.mat')`. **Supplementary figures S7-S18** Figures can be generated with the code from the main figures (see annotations). Load helper functions by running `addpath(genpath('...\auxillary'))`; **Data structure:** 'DataAll.(Aud1)': Initial auditory-go group 'DataAll.(Vis1)': Initial visual-go group E.g. `DataAll.('Aud1')(n).BHV.Naive{m}.FieldName` (n: n-th mouse; m: m-th session) `FieldName` `StimStart`: Stimulus start time (s) `ICF`: raw calcium trace (sample,cell) `LickPulse`: Lick time (s) `Trial_Freq`: Auditory stimulus frequency `Trial_Grat`: Visual stimulus angle `RotaryEncPulse`: Rotary encoder pulse (no direction)