Problem integrating python in simulink

2 ビュー (過去 30 日間)
Nadjib
Nadjib 2024 年 1 月 26 日
コメント済み: Nadjib 2024 年 1 月 27 日
Hi, I am trying to use a matlab function block in simulink, but i am getting the following error: Cell contents reference from a non-cell array object. Function 'Sistema Function' (#24.229.236), line 5, column 9: "pout{1}"
and this is my matlab function which try to call a python function:
function [pvagent,batteryagent,gridimport,gridexport]= fcn(pv,load,soc)
coder.extrinsic('py.simult.simulationat')
pout=py.simult.simulationat(load,pv,soc);
pout = cell(pout); % Convert the output to a MATLAB cell array
pvagent=pout{1};
batteryagent=pout{2};
gridimport=pout{3};
gridexport=pout{4};
please, how to solve this problem knowing that my python function returns 4 values?

回答 (1 件)

Benjamin Thompson
Benjamin Thompson 2024 年 1 月 27 日
Have you tried debugging the MATLAB code in the block? Maybe pout is empty.
  1 件のコメント
Nadjib
Nadjib 2024 年 1 月 27 日
yes, i did

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

カテゴリ

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