Matlab 2018 ((link)) Page
If you are maintaining code or models created in MATLAB 2018, here is what you need to know before moving to a newer version (R2023b or later):
: Starting with R2016b and continuing through the 2018 versions, users could define local functions within scripts . Previously, functions had to be stored in separate .m files. matlab 2018