Adaptive filters modify the filter's parameterization so it can adjust to changing conditions. For example, it might alter the process noise Q to adjust to changing accelerations. You do not want to accept noise when acceleration is low, but do want to respond to rapid changes when acceleration is occurring.
There are many techniques for adaptively changing the parameters; there is no canonical 'code' for it.
You can refer to the Adaptive Filtering chapter in my book, available online with the link below; it goes through several adaptive algorithms. It's Python, not MATLAB, but should be readable to you.
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/14-Adaptive-Filtering.ipynb