Facing below problem while linking CoolProp with MATLAB

pyversion
version: '2.7'
executable: 'C:\Users\Shehryar Ishaque\Anaconda2\python.EXE'
library: 'C:\Users\Shehryar Ishaque\Anaconda2\python27.dll'
home: 'C:\Users\Shehryar Ishaque\Anaconda2'
isloaded: 0
>> [v,e] = pyversion; system([e,' -m pip install --user -U CoolProp'])
'C:\Users\Shehryar' is not recognized as an internal or external command,
operable program or batch file.
ans =
1

 採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 27 日

1 投票

[v,e] = pyversion;
cmd = sprintf('"%s" -m pip install --user -U CoolProp', e);
system(cmd)

4 件のコメント

NAVEED ULLAH
NAVEED ULLAH 2021 年 12 月 28 日
Thankyou for always helping,
the problem erased. but when i calculate humid properties is give me error like that , will you please guide how to fix
Walter Roberson
Walter Roberson 2021 年 12 月 28 日
You need py.Coolprop.Coolprop.HAPropsSI
NAVEED ULLAH
NAVEED ULLAH 2021 年 12 月 31 日
can you please guide me to get py.Coolprop.Coolprop.HAPropsSI resolve the issue
Walter Roberson
Walter Roberson 2021 年 12 月 31 日
http://www.coolprop.org/apidoc/CoolProp.CoolProp.html documents CoolProp.CoolProp.HAPropsSI so once (recent enough) CoolProp is installed,
T = py.CoolProp.CoolProp.HAPropsSI('T', 'P', '101325', 'H', H, 'R', 1.0)

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

その他の回答 (1 件)

Shanmukha Voggu
Shanmukha Voggu 2021 年 12 月 27 日
編集済み: Shanmukha Voggu 2021 年 12 月 27 日

0 投票

Hi naveed,
system(command) calls the operating system to execute the specified command.
If you want to run multiple commands, use && between consecutive commands for windows
Refer to documentation of system
Hope this helps!

3 件のコメント

Walter Roberson
Walter Roberson 2021 年 12 月 27 日
[v,e] = pyversion;
array = [e,' -m pip install --user -U CoolProp']
array = '/usr/bin/python -m pip install --user -U CoolProp'
whos array
Name Size Bytes Class Attributes array 1x49 98 char
array
array = '/usr/bin/python -m pip install --user -U CoolProp'
This tells us that the result of [e,' -m pip install --user -U CoolProp'] is a character vector, as required by system() .
The problem is not in the fact that the character vector is constructed instead of being static. The constructed character vector is as valid for the purpose of system() as if the content of the constructed character vector had been hard-coded in a system() call.
The problem is that the executable name happens to have spaces in it, and Windows is treating those spaces as the end of the command to execute, with the parts after the space being treated as parameters or options to the call. The cure is to ensure that the path to the executable is quoted when it goes into system()
Shanmukha Voggu
Shanmukha Voggu 2021 年 12 月 27 日
Thanks for clarification.
NAVEED ULLAH
NAVEED ULLAH 2021 年 12 月 28 日
thank you

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

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by