1. In MATLAB type the command pyversion into the command window. If no version of python is shown then complete the following 3 steps. If you do have a version of python then go directly to step 2.
a. Go to python.org and download a 64 bit version of python. As of the writing of this document a 64 bit version of python is located at https://www.python.org/downloads/release/python-371/. I used the Windows x86-64 web-based installer version (scroll to the bottom to see it), and it worked well.
b. Locate where the python executable (python.exe) was installed on your computer. In my case it was installed at C:\Users\AppData\Local\Programs\Python\Python37\python.exe
Note: I had some trouble with part c below when there were spaces in the directory path. Make sure you install it in a directory without spaces in any directory names. (e.g., C:\Program Files\Python\Python37\python did not work in part c below because of the space between Program and Files.)
c. The first time you install python you will need to run the following command from the matlab command window. You only need to do this once. Note that you will need to provide the full path to the python executable you determined in step 2 when using the pyversion function.
pyversion 'C:\Users\AppData\Local\Programs\Python\Python37\python.exe'
2. The first time you wish to use CoolProp you will need to do the following
[v,e] = pyversion; system([e,' -m pip install --user -U CoolProp'])
This command will download and install CoolProp on your computer.
3. For any matlab script that calls CoolProp, after the “clear all; close all; clc;” in your script, add the line
import py.CoolProp.CoolProp.*
4. You can confirm that everything is working correctly by calling Coolprop using
PropsSI('T','P',101325,'Q',0,'Water')
If you have done anything correctly you should get 373.1243.
Note that you could do step 3 and 4 from the command window as well.