MATLAB call python

Make sure the Python module is on the Python search path. To test if module mymod is on the path, type:

1
py.importlib.import_module('mymod')

If Python cannot find the module, MATLAB displays a Python error message.

To add mymod, in folder modpath, to the path, type:

1
2
3
4
P = py.sys.path;
if count(P,'modpath') == 0
insert(P,int32(0),'modpath');
end

load

py.importlib.import_module('mymod')

reload

py.reload(mod);

get data

1
2
3
d=py.sys.path;
d=cell(d);
dat=char(d{1});

data trans

  • 时间 py.datetime.date(int32(2011),int32(1),int32(1))
  • string py.str(matlab char)
  • list py.list(matlab cell)

matlab python std 差别

MATLAB默认用无偏/N-1 PYTHON默认用总体/N

留言