Function handles to all local functions in MATLAB file
fcns = localfunctions returns a cell array of function handles, fcns, to all local functions in the current file.
You cannot define local functions in the context of the command line, scripts, or anonymous functions, so when you call localfunctions from these contexts, you get an empty cell array. Within the cell array, localfunctions returns the function handles in an undefined order.
Create a new file, fileWithLocalFunctions.m, in your MATLAB path. In the main function, call and display the results of localfunctions. In the same file, create two local functions.
function fileWithLocalFunctions fcns = localfunctions; display(fcns); function alocalfunction function anotherlocalfunction
From the command line, call your function.
fcns = @alocalfunction @anotherlocalfunction