Matlab is showing the following error -'Unrecognized function or variable 'importPhase'.'

21 ビュー (過去 30 日間)
Rahul Suman
Rahul Suman 2020 年 8 月 3 日
編集済み: David 2022 年 7 月 1 日
I am using Cantera (2.4.0) through Matlab (2020a). I have followed the instructions given here https://cantera.org/install/windows-install.html to install cantera and configure matlab to use it .
I am a new user to both matlab and cantera and wanted to try some basic tutorials given ,but when I entered the following code ,
gas1 = importPhase('gri30.cti', 'gri30');
msg = sprintf('time to create gas1: %f', cputime - t0)
Matlab showed an error saying ,'Unrecognized function or variable 'importPhase'.
Other answers suggest improperly specifying path to the matlab could result in this ,but i have followed all the instructions in the installation guide.
Any help would be appreciated
  1 件のコメント
Dalisizwe Sibanda
Dalisizwe Sibanda 2020 年 8 月 30 日
Hi Rahul, were you ever able to sort out the issue with Cantera? I am trying to use it with T-MATS, but have not to get things working at all. If you could share hot ot fix the problem it would be such a huge help.

サインインしてコメントする。

回答 (2 件)

David
David 2021 年 8 月 27 日
Though this is a Cantera question, I had the same question and had difficulty finding an answer, so I will put it here. The function importPhase was deprecated in Cantera 2.3 and replaced with Solution. See some discussion here: https://github.com/Cantera/cantera/pull/383
In this discussion, the developers mention that Solution() creates a Solution object. I am now running into other problems, so I cannot confirm that simply replacing importPhase with Solution will work, but it seems like this was the developers' intention.
  2 件のコメント
晓阳 刘
晓阳 刘 2022 年 7 月 1 日
I am using the matlab2018,it seems that this version either function the importPhase nor the solution. I dont know it .
David
David 2022 年 7 月 1 日
編集済み: David 2022 年 7 月 1 日
Perhaps I should give an update to my answer. Solution did indeed replace importPhase. The command should look like
solution = Solution('air.yaml');
or
solution = Solution('air.yaml', 'air');
Note that air.yaml is automatically installed in Program Files\Cantera\data during Cantera installation. 'air' is the name of a phase within the air.yaml file. If the above lines do not work, I would guess Cantera is not installed properly. On that note, I used these instructions.
The problem I ran into is that Solution('air.cti') does not work. You MUST convert the data files to YAML format to use the Solution() function. You can convert the files in Python using cti2yaml.py. There are helpful tips somewhere in the Cantera community for doing this. This has nothing to do with MATLAB anymore so I will stop.

サインインしてコメントする。


Abhishek Gupta
Abhishek Gupta 2020 年 8 月 26 日
Hi Rahul,
As per my understanding, you are encountering an error message, while accessing Cantera package.
Referring to the following link, which might help you in resolving the issue:-
Regards,
Abhishek Gupta

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by