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

26 Ansichten (letzte 30 Tage)
Stefanie De Graaf
Stefanie De Graaf am 13 Okt. 2016
Beantwortet: David am 27 Aug. 2021
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 Kommentare
Stefanie De Graaf
Stefanie De Graaf am 11 Jan. 2018
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 am 30 Nov. 2020
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

David
David am 27 Aug. 2021
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

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by