diff --git a/Source/Modules/matlab.cxx b/Source/Modules/matlab.cxx index cfb2ae5e09c..434e166fc5d 100644 --- a/Source/Modules/matlab.cxx +++ b/Source/Modules/matlab.cxx @@ -2609,13 +2609,14 @@ int MATLAB::insertDirective(Node *n) { String *code = Getattr(n, "code"); String *section = Getattr(n, "section"); - if (Cmp(section, "matlab") == 0) { + if (Cmp(section, "matlab") == 0 && f_wrap_m) { Printv(f_wrap_m, code, NIL); } else if (Cmp(section, "matlabsetup") == 0) { Printv(f_setup_m, code, NIL); } else { Language::insertDirective(n); } + return SWIG_OK; }