diff --git a/nipype/interfaces/matlab.py b/nipype/interfaces/matlab.py index 03e34b0b43..294abdf3ef 100644 --- a/nipype/interfaces/matlab.py +++ b/nipype/interfaces/matlab.py @@ -191,7 +191,10 @@ def _gen_matlab_command(self, argstr, script_lines): else: prescript.insert(0, "fprintf(1,'Executing code at %s:\\n',datestr(now));") for path in paths: - prescript.append("addpath('%s');\n" % path) + # addpath() is not available after compliation + # https://www.mathworks.com/help/compiler/ismcc.html + # https://www.mathworks.com/help/compiler/isdeployed.html + prescript.append("if ~(ismcc || isdeployed), addpath('%s'); end;\n" % path) if not mfile: # clean up the code of comments and replace newlines with commas