Suppose you use ANY MATLAB function? How does it work? For example...
Suppose you want to compute the mean of that vector? Do you do it like this?
If you do, then where does the result get stored?
If you look, the result got dumped unceremoniously into ans. You need to put it INTO somethign to get stored. The name in the function definition does nothing, except tell MATLAB which variable to return.
If you want to put it into something, then you do this:
Now a result exists in a variable with my choice of name, NOT in ans.
When you return a variable, you need to remember the name of that variable when inside the function is not retained. The outside world does not know anything about the variable names inside your function.