Simultaneous use of Cantera in both Matlab and Python

19 views
Skip to first unread message

Elouan MAITRE

unread,
May 24, 2024, 3:02:18 PMMay 24
to Cantera Users' Group
Hello !

I'm currently using Cantera with Matlab in order to estimate combustor performance. However, I need to use the "Quantity" class of Cantera, which is available only with the Python module.

My project is in Matlab and must stay in it for technical reasons. I therefore wanted to run some python commands in my matlab scripts in order to use the Cantera functions I need. However, something critical would be to modify, using python commands, a Matlab "Solution" object. Does anyone know if it is possible to somehow convert a Matlab "Solution" object to a python "Solution" object ?

Trying to apply "Quantity" to a Matlab "Solution" object leads to the following error  :
Error using py.cantera.Quantity
Conversion of MATLAB 'Solution' to Python is not supported.

Thanks in advance ;)

Ray Speth

unread,
May 27, 2024, 1:06:51 PMMay 27
to Cantera Users' Group

Hi,

No, mixing Cantera objects between the Python interface and the Matlab interface is not possible.

The Python Quantity class is fairly simple in terms of what it does. I think you could probably recreate the necessary behavior natively in Matlab without too much difficulty.

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages