MATLAB Answers


MCR addpath thirdparty toolbox

Asked by Golam Chowdhury on 24 May 2017
Latest activity Answered by Nagarjuna Manchineni on 26 May 2017
Hi, I am using a custom made matlab program, but it uses additional scripts that I placed in sub-directory, in addition to it, I am using some toolboxes. The program uses the sub-routines in the toolboxes that are placed in many (sub)-directories. I would like to preserve the directory structure in my program. When I compile using addpath command and submit to a cluster, the program is terminated stating that sub-routines are not accessible. I have used
if ~isdeployed addpath('some-directory') end
but does not solve the problem. Any clue how to successfully run it, after compilation together with preserving the directory structure, rather than copying all the routines in the same folder?
I get this error:
Usage: ./ deployedMCRroot args

  1 Comment

on 24 May 2017
Can you not just add the sub directories to your path in the normal manner, permanently, rather than doing it in code in the program itself?
If they are dependencies of your program though they should get automatically picked up and added into the code structure that is replicated on the target machine.

Sign in to comment.

1 Answer

Answer by Nagarjuna Manchineni on 26 May 2017

  • If you are directly calling (not by 'eval(....functionName....)' or constructing function file path in a string and calling the function etc..) the functions directly in your code then MATLAB dependency analyzer will add those functions in the deployed application.
  • If you are not calling the functions in the program directly, then try attaching those files/directory while compiling the MATLAB code either by using '-a' flag or by adding them to "Files required for your application to run" section of the compiler application. Using this the files will be available when the application is deployed and also the directory structure is retained (relative path).
Refer to the following documentation link for more information:


Sign in to comment.