Running python script in matlab and see life results

2 ビュー (過去 30 日間)
Zehao Pan
Zehao Pan 2019 年 5 月 1 日
回答済み: Guillaume 2019 年 5 月 1 日
So I'm running my python file with matlab using [status, result] = system(systemCommand); with systemCommand being an string of like python program.py
I did this because I need to use the returning status to determine the next step, if the program was sucess look for output file if not then do something else.
However when I do this I stop seeing the live python part, when I just used system(systemCommand); it showed me what the python part was doing. Is there anyway to use [status, result] = system(systemCommand); and still see what the python script is doing? Or just run system(systemCommand); and catch that 0 or -1 return some other way? Thanks!
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 5 月 1 日
If you using Mac or Linux then try sending a copy of stdout to stderr or to /dev/tty if need be.

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

回答 (1 件)

Guillaume
Guillaume 2019 年 5 月 1 日
Why not call the python code directly from matlab without passing through the command line?

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by