How can I make Cantera functions available in Matlab or link them?
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 13 Oct 2016
Did you go through the installation instructions at http://www.cantera.org/docs/sphinx/html/install.html ?
Step 7 of the Windows instructions might require administrative access to save the environment variables; I am not certain about that.
Stefanie De Graaf
le 11 Jan 2018
Shubham Pandit
le 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
Réponses (1)
David
le 27 Août 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
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!