From: us on
"Ed Murphy" <murphy294(a)hotmail.com> wrote in message <ef53653.-1(a)webcrossing.raydaftYaTP>...
> Does anyone know how to write matlab code that can parse a function
> m-file and determine whether the functions defined within it are
> nested functions or subfunctions?
>
> Specifically, it would seem that one of the most difficult cases to
> distinguish would be when there is a mix of subfunctions and nested
> functions.
>
> If you had two functions defined within the primary function and none
> of those functions were terminated with an 'end' keyword, you would
> know that they must both be subfunctions. But if all functions within
> the primary are terminated with 'end', I don't see how one could tell
> the difference, yet it must be possible.
>
> Any Thoughts?

a hint:
- this FEX submission does what you want

http://www.mathworks.com/matlabcentral/fileexchange/15924-farg-a-pedestrian-m-file-parser-showing-all-used-functions-syntax

% this does even a bit more
http://www.mathworks.com/matlabcentral/fileexchange/17291-fdep-a-pedestrian-function-dependencies-finder

us