How do I determine if a function is user-defined or belongs to a MATLAB toolbox?

How do I determine if a function is user-defined or belongs to a MATLAB toolbox?

 Accepted Answer

1) As a quick initial step, search for the function name in the MATLAB online documentation. If the function does not appear in the search results, it is likely not part of any current MATLAB toolbox.
Note that the online documentation archive only covers the past 5 years. If the source code was written more than 5 years ago, it might reference a MATLAB function that existed only in previous versions of MATLAB.
2) If the code runs as expected in your current MATLAB session, use the "which" function to locate the source of the function name:
>> which funName -all
If the function is user-defined, the output will show the path to the .m file where the function is defined. For example:
C:\work\funName.m
If the function belongs to a MATLAB toolbox, the output will show a path that is within the MATLAB installation directory, typically containing the name of the toolbox. For example:
C:\Program Files\MATLAB\R20XXx\toolbox\<sometoolbox>\funName.m
If the function is overloaded or has multiple definitions, the "which -all" command will list all the locations.

More Answers (0)

Categories

Find more on Software Development in Help Center and File Exchange

Products

Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!