JCV
JCV

Reputation: 515

Restart Matlab Kernel

I'm running a Python function in Matlab, and when I make some modifications in the Python function in Python, and then run in Matlab, Matlab doesn't make the modifications, still running the function as it was before, even if that function doesn't exist anymore, I only overcome that closing Matlab and restart again, but this takes a long time and requires me manually to close Matlab, is there any way to restart Matlab without leaving the interpreter? like in Python we can restart the Kernel without closing Spyder...

Upvotes: 1

Views: 870

Answers (1)

mimocha
mimocha

Reputation: 1121

Per the documentation, you follow these steps to update a python module.

  1. Unload module
  2. Import new module
  3. Reload module (syntax depends if Python is version 2.7 or 3.X)
% Unload module
clear classes

% Import new module
mod = py.importlib.import_module('myPyFilename');

% Reload module (Python 2.7)
py.reload(mod);

% Reload module (Python 3.X)
py.importlib.reload(mod);

Upvotes: 4

Related Questions