How to call Python Script in Matlab

9 ビュー (過去 30 日間)
Akshay Dhyani
Akshay Dhyani 2020 年 11 月 18 日
回答済み: Rifshu Hussain Shaik 2022 年 2 月 15 日
Hi,
I want to call python script into Matlab for further processing. I watched couple of threads mentioned at https://stackoverflow.com/questions/1707780/call-python-function-from-matlab but always gets an error when do this in command prompt
>> py.ReadIFSLog
Unable to resolve the name py.ReadIFSLog
I have MATLAB 2020a. What am I doing wrong?

採用された回答

Kunal Kumar
Kunal Kumar 2020 年 11 月 19 日
I understand that you are trying to call your own python script from MATLAB command window.
The syntax that you are using is for calling python built-in modules from MATLAB, not scripts. Please have a look at the answer posted for a similar question.
  2 件のコメント
Akshay Dhyani
Akshay Dhyani 2020 年 11 月 20 日
編集済み: Akshay Dhyani 2020 年 11 月 23 日
It works when I change the perl.m file to python.m and then call the script.
A new issue.
Python function returns 22 variables which are array. How to get those variable in the workspace?
Akshay Dhyani
Akshay Dhyani 2020 年 11 月 24 日
Update: Looks like I cannot call a function which call another function. I think its better to save the output file in python as .mat and then just use the output from it.

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

その他の回答 (1 件)

Rifshu Hussain Shaik
Rifshu Hussain Shaik 2022 年 2 月 15 日
try this in matlab to open python script
system('python filename.py');

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by