MATLAB Engine API for Python: MATLAB struct

29 ビュー (過去 30 日間)
Jay Braun
Jay Braun 2019 年 5 月 21 日
回答済み: Sean Holden 2020 年 4 月 1 日
I am using the MATLAB Engine API for Python. MATLAB version is 2018a, Python version is 3.6.6, and I am running on Linux.
For the first time in my experience, I am invoking a MATLAB function that returns a MATLAB struct, with the intention of processing it as a dict. But I am getting
TypeError: unsupported data type returned from MATLAB
Short of returning the fields as separate arguments, is there a way to return a MATLAB struct? I know that at one time is was unsupported, and would appreciate a workaround if this is still the case.
Here is the first line of the MATLAB function:
function [ ptm ] = multitrain( datamat, configin, buffersize )
and here is the invocation:
ptm = eng.multitrain(ml_list,'outputfilename',50.0,nargout=1)

回答 (1 件)

Sean Holden
Sean Holden 2020 年 4 月 1 日
What are the data types of the fields inside the struct? A struct itself will map to a Python dict, so the error is probably coming from an unsupported field type (e.g. a Cell array).
More info about supported data types from MATLAB to Python can be found in the Engine API docs.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by