MATLAB Answers

Identify dependencies for a script on MATLAB

18 views (last 30 days)
I currently have multiple scripts and when I run a specific script among those, I receive an error that says 'Undefined variable or function'. I would like to identify the dependencies for this script so that I can gather all the required data before running it.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Sep 2016
Below are a couple of ways to determine dependencies for a script on MATLAB:
  • Before you begin this step, please ensure that all the necessary script files are placed in one folder and this folder is your current working directory. On the window that displays all the files and folders in the current working directory, there is a blue tab on the top that says 'Current Folder' and has a downward arrow (refer attached image). Please click on this arrow, select Reports ---> Dependency Report. This will provide you with a list of all dependencies of the files present in the current working directory.
  • Alternatively, you can also refer to the documentation in the following link for other methods to identify program dependencies:
                  <http://www.mathworks.com/help/matlab/matlab_prog/identify-dependencies.html?s_tid=srchtitle>
The above two steps should help you resolve the issue.
 

More Answers (1)

Daniel Frisch
Daniel Frisch on 13 Nov 2020
This function finds all dependencies and directly copies them to a folder:
>> copy_dependencies( 'matlabScript.m' )

Community Treasure Hunt

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

Start Hunting!