It ran for me with no errors.
Note that you never actually call either nestFunction() or localFunction(). You just assign function handles and exit. So, they never actually use your x, y, v, or z variables. Just leave off the semicolon when you call
[hNest,hLocal] = functionsExample(5)
or set a break point in those functions to verify that fact.