Assertion error Matlab R202b

조회 수: 4 (최근 30일)
martijn van Meijel
martijn van Meijel 2021년 4월 21일
댓글: martijn van Meijel 2021년 4월 21일
Dear,
Currently I am using Python to request some data from Matlab. I perform this by first enabling the shared option with Matlab using:
matlab.engine.shareEngine()
Following this I attempt to connect with matlab inside Python using:
try:
findSes = matlab.engine.find_matlab()
eng = matlab.engine.connect_matlab(findSes[0])
except EngineError:
eng = matlab.engine.start_matlab()
This usually works, but somehow it sometimes can't connect which results in that the script does not execute. Another error which exists is the following one, which appears in the Python kernel:
Assertion failed: frame‑>index() == index
Function: unsigned __int64 __cdecl foundation::msg_svc::transport::layers::message::Message::append(class std::unique_ptr<class foundation::catapult::carrier::framing::Frame,struct std::default_delete<class foundation::catapult::carrier::framing::Frame> > &&), file b:\matlab\foundation\message_services\transport\layers\message\message.cpp, line 149
I hope someone could assist me on how to solve this error.
Thanks

답변 (1개)

Hiro Yoshino
Hiro Yoshino 2021년 4월 21일
I am not sure what you're trying to do though, one of the most frequent mistakes peopel make is data type incompatibility.
You should specify the data type as follows:
try:
findSes = matlab.engine.find_matlab()
eng = matlab.engine.connect_matlab(double(findSes[0]))
except EngineError:
eng = matlab.engine.start_matlab()
  댓글 수: 1
martijn van Meijel
martijn van Meijel 2021년 4월 21일
Thanks for your answer. The code your qouted is within Python in order to find any present shared Matlab session. Therefore I would not need to convert it.
I maybe need to specify that the problem does only occur sometimes. Thus It can run the Matlab script multiple times, and then suddenly it cannot connect anymore. I call the Matlab script then using:
eng.windingPathGenerate(nargout=0)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by