MATLAB not converting 2D arrays to Python arrays. "No module named 'libmwbuffer'" error.

82 ビュー (過去 30 日間)
Hello,
I am trying to use Python with MATLAB. I am unable to pass certain MATLAB variables, namely arrays of 2 or more dimensions.
An excerpt of my code:
pyenv; % Version 3.8
np = py.importlib.import_module('numpy');
a = [1 2; 3 4];
a_py = np.array(a)
I get the error:
% Python Error: ModuleNotFoundError: No module named
% 'libmwbuffer'
% Python function '' might not be able to accept at least one
% input argument at position 1. The function may require a
% specific data type that you can construct from the MATLAB
% array. For more information, see the documentation for
% Python function '' and working with Python arrays.
Does anyone know what I am doing wrong? Do I have to install additional modules? Should I change my version of Python?
Thank you.

採用された回答

Abhinav Gupta
Abhinav Gupta 2021 年 6 月 14 日
Hi,
I think this issue occured because of unsupported version of Python on your system. You could refer to the links below to install Matlab-supported Python version in accordance with your Matlab version.
Hope it helps.
  1 件のコメント
José Felgueiras
José Felgueiras 2021 年 6 月 17 日
Thank you for the reply.
Python version 3.8 is compatible with R2020b, not R2020a. That is why it was failing.
Downgrading to 3.7 fixed it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by