Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Finding nested function names?

Subject: Finding nested function names?

From: Alexis

Date: 1 Dec, 2012 00:11:07

Message: 1 of 4

I would like a list of the nested functions within a function. Is there any way of getting this information?

Example:

function myfunc

    findSubFuncs % gives a list of the subfunctions within this function, like {'subFunc1', 'subFunc2', 'subFunc3', 'subFunc4'}

    function subFunc1
    end

    function subFunc2
    end

    function subFunc3
    end

    function subFunc4
    end
end

Subject: Finding nested function names?

From: Kristin

Date: 24 Jan, 2013 02:40:08

Message: 2 of 4

"Alexis" wrote in message <k9bhur$33e$1@newscl01ah.mathworks.com>...
> I would like a list of the nested functions within a function. Is there any way of getting this information?
>
> Example:
>
> function myfunc
>
> findSubFuncs % gives a list of the subfunctions within this function, like {'subFunc1', 'subFunc2', 'subFunc3', 'subFunc4'}
>
> function subFunc1
> end
>
> function subFunc2
> end
>
> function subFunc3
> end
>
> function subFunc4
> end
> end

I am curious about this as well. The annoying way to do this is to read the mfile as a text file and search etc etc.... But I am interested in a good solution...

Subject: Finding nested function names?

From: Steven_Lord

Date: 24 Jan, 2013 14:49:00

Message: 3 of 4



"Kristin " <kholmbeck@mac.com> wrote in message
news:kdq6u8$sqi$1@newscl01ah.mathworks.com...
> "Alexis" wrote in message <k9bhur$33e$1@newscl01ah.mathworks.com>...
>> I would like a list of the nested functions within a function. Is there
>> any way of getting this information? Example:
>>
>> function myfunc
>>
>> findSubFuncs % gives a list of the subfunctions within this function,
>> like {'subFunc1', 'subFunc2', 'subFunc3', 'subFunc4'}
>>
>> function subFunc1
>> end
>>
>> function subFunc2
>> end
>>
>> function subFunc3
>> end
>>
>> function subFunc4
>> end
>> end
>
> I am curious about this as well. The annoying way to do this is to read
> the mfile as a text file and search etc etc.... But I am interested in a
> good solution...

Out of curiosity, what would you use this information to do?

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Finding nested function names?

From: Kristin

Date: 21 Nov, 2013 00:38:21

Message: 4 of 4

"Steven_Lord" <slord@mathworks.com> wrote in message <kdrhks$pe6$1@newscl01ah.mathworks.com>...
>
>
> "Kristin " <kholmbeck@mac.com> wrote in message
> news:kdq6u8$sqi$1@newscl01ah.mathworks.com...
> > "Alexis" wrote in message <k9bhur$33e$1@newscl01ah.mathworks.com>...
> >> I would like a list of the nested functions within a function. Is there
> >> any way of getting this information? Example:
> >>
> >> function myfunc
> >>
> >> findSubFuncs % gives a list of the subfunctions within this function,
> >> like {'subFunc1', 'subFunc2', 'subFunc3', 'subFunc4'}
> >>
> >> function subFunc1
> >> end
> >>
> >> function subFunc2
> >> end
> >>
> >> function subFunc3
> >> end
> >>
> >> function subFunc4
> >> end
> >> end
> >
> > I am curious about this as well. The annoying way to do this is to read
> > the mfile as a text file and search etc etc.... But I am interested in a
> > good solution...
>
> Out of curiosity, what would you use this information to do?
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


I'm not sure why I was interested in this at the time, but I suppose you could use the dbstack function.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us