MATLAB: Whats the use of an inline function (function at end of script)

function

is the primary benefit not having extra function files for a script?

Best Answer

Reducing the number of files is one benefit. Another is that the function becomes private to the script.
When routines are not too large, it can be easier to read them together when they are in the same file.