Returning a Handle for Use Outside of a Function File
As stated previously, you can use function handles to call a function that may otherwise be hidden or out of scope. This example function getHandle returns a function handle fHandle to a caller that is outside of the file:
function fHandle = getHandle
fHandle = @subFun;
function res = subFun(t1, t2, varargin);
...
Call getHandle to obtain a function handle with which to invoke the local function. You can now call the local function as you would any function that is in scope:
f1 = getHandle;
result = f1(startTime, endTime, procedure);