Running a Python Script with multiple inputs and outputs through Matlab
14 ビュー (過去 30 日間)
古いコメントを表示
Constantinos Florides
2021 年 8 月 19 日
コメント済み: Yongjian Feng
2021 年 8 月 29 日
Hallo, i have a pytho script with 10 inputs and 5 outputs and the on of the outputs is a list. I want to run this script throught matlab and give my inputs in matlab and then receive the outputs from Python in Matlab. Is that possible? I have tried some things, but i could redirect only one output from python to matlab. I am open to suggestion :)
0 件のコメント
採用された回答
Yongjian Feng
2021 年 8 月 21 日
One interesting trick is to use json. From python, serialize all the outputs into one single json string. In matlab, convert the json string back to json.
2 件のコメント
Yongjian Feng
2021 年 8 月 29 日
Yes, you can do it with a json file as well. But then you need to write and read the file. Also if you write to a file, it doesn't need to be json.
その他の回答 (1 件)
Rhea Chandy
2021 年 8 月 23 日
Hello Constantinos,
I understand that you're trying to run python script in MATLAB and then recieve outputs from Python in MATLAB.
Along with the above answer, you can also take a look at this previously answered question: Running python script in matlab
You will find the following resources with more information and examples here:
参考
カテゴリ
Help Center および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!