How can I make Cantera functions available in Matlab or link them?

25 次查看(过去 30 天)
I am working with a Matlab script that calls for Cantera functions such as "IdealGasMix('gri30.cti','gri30_mix')".
Originally the script was written to be used with Cantera-1.8.0., whereas I am using Cantera-2.2.1. Nevertheless I have tried using different Cantera functions such as addDirectory() or importPhase('gri30.cti','gri30_mix'), but I always get the message, that the function can not be found. I was told that if Matlab is installed before Cantera, all necessary packages from Cantera will automatically be included...
What do I need to do to make Matlab link to those packages? Do I need to install additional tools? How do I include those?
Any suggestions may be of help, so please feel free to answer, if you have any ideas?
Thanks so much!
Cheers, Stefanie
BTW I am working with Matlab through a license provided by my school and therefore I am usually connected to it via VPN. Not sure if that makes a difference...
  3 个评论
Stefanie De Graaf
Stefanie De Graaf 2018-1-11
Hi Walter! Yes I did follow these instructions. I am on a Ubuntu machine though.
Any suggestions what I need to do to load the cantera functionality?
The error I am getting in Matlab is:
Undefined function or variable 'importPhase'.
Error in boundarypoints (line 4) gas = importPhase('gri30.cti','gri30_mix');
Stefanie
Shubham Pandit
Shubham Pandit 2020-11-30
Hey Stefanie
Did you get answer for your quesry? I am facing the same problome. I don't even know how to install cantera in Ubuntu 18.04.5 LTS such that it can work in MATLAB.
Any help will be greatly appreciated! Thanks!
Shubham Pandit

请先登录,再进行评论。

回答(1 个)

David
David 2021-8-27
I think this is really a Cantera question. There are a couple of steps where the installation can go wrong. See the Cantera installation instructions, including how to make it talk to MATLAB, here: https://cantera.org/install/index.html. For a Windows operating system, there are more details on interfacing to MATLAB here: https://cantera.org/install/windows-install.html. Note that you have to install Python, Cantera, and MATLAB.
To check if everything is talking, follow the advice at the bottom of the installation page. That is, try running (in MATLAB)
h2o = Solution('liquidvapor.yaml','water')
This checks that MATLAB can find the Solution function and the requested data file. Some functions, including importPhase, are now deprecated. This caught me for quite some time, and motivated me to provide answers to these questions. See more discussion on importPhase here: https://www.mathworks.com/matlabcentral/answers/574450-matlab-is-showing-the-following-error-unrecognized-function-or-variable-importphase

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by