Skip to content

Commit a101d24

Browse files
FIX: Deployed Matlab apps must not call addpath()
https://mathworks.com/help/compiler/isdeployed.html The path of a deployed application is fixed at compile time and cannot change. Use isdeployed to ensure that the application uses path modifying functions, such as addpath, before deployment. This fixes the case where nipype calls SPM12 Standalone, associated to Matlab Compiler Runtime (MCR) R2019a (9.6) or later. Upcoming versions of SPM12 Standalone will most probably be compiled with Matlab R2021b, and hence will be subject to this bug.
1 parent 8f405f6 commit a101d24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nipype/interfaces/matlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _gen_matlab_command(self, argstr, script_lines):
191191
else:
192192
prescript.insert(0, "fprintf(1,'Executing code at %s:\\n',datestr(now));")
193193
for path in paths:
194-
prescript.append("addpath('%s');\n" % path)
194+
prescript.append("if ~(ismcc || isdeployed), addpath('%s'); end;\n" % path)
195195

196196
if not mfile:
197197
# clean up the code of comments and replace newlines with commas

0 commit comments

Comments
 (0)